package main import ( "fmt" "math" "sort" ) func abs(a int) int { return int(math.Abs(float64(a))) } func min(a, b int) int { return int(math.Min(float64(a), float64(b))) } func resolve(N int, X []int) int { ret := 1000001 sort.Ints(X) for i := 0; i < N-1; i++ { if X[i] == X[i+1] { continue } ret = min(ret, abs(X[i]-X[i+1])) } if ret == 1000001 { return 0 } return ret } func main() { var N int fmt.Scanf("%d\n", &N) X := make([]int, N) for i := 0; i < N; i++ { fmt.Scanf("%d", &X[i]) } fmt.Println(resolve(N, X)) }