← Home
For problem statement at 0-999/900-999/900-909/903/problemD.txt this is a correct solution, but verifier at 0-999/900-999/900-909/903/verifierD.go ends with All tests passed can you fix the verifier? ```go
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(in, &n)

	counts := make(map[int32]int64)
	sum := big.NewInt(0)
	term := big.NewInt(0)

	for i := 0; i < n; i++ {
		var v int32
		fmt.Fscan(in, &v)

		val := int64(v) * int64(2*i+1-n)
		val -= counts[v-1]
		val += counts[v+1]

		term.SetInt64(val)
		sum.Add(sum, term)

		counts[v]++
	}

	fmt.Println(sum.String())
}
```