← Home
For problem statement at 1000-1999/1100-1199/1150-1159/1154/problemB.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1150-1159/1154/verifierB.go ends with all tests passed can you fix the verifier? ```go
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	m := make(map[int]bool)
	var vals []int
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		if !m[a] {
			m[a] = true
			vals = append(vals, a)
		}
	}

	sort.Ints(vals)

	if len(vals) == 1 {
		fmt.Println(0)
	} else if len(vals) == 2 {
		diff := vals[1] - vals[0]
		if diff%2 == 0 {
			fmt.Println(diff / 2)
		} else {
			fmt.Println(diff)
		}
	} else if len(vals) == 3 {
		if vals[1]-vals[0] == vals[2]-vals[1] {
			fmt.Println(vals[1] - vals[0])
		} else {
			fmt.Println(-1)
		}
	} else {
		fmt.Println(-1)
	}
}
```