package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func nextInt(sc *bufio.Scanner) int { sc.Scan() t, _ := strconv.Atoi(sc.Text()) return t } func main() { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) N := nextInt(sc) X := make(map[int]int, 0) for i := 0; i < N; i++ { X[nextInt(sc)]++ } ks := make([]int, 0) for k := range X { ks = append(ks, k) } sort.Ints(ks) // fmt.Println("N", N, "X", X, "ks", ks) var ans int if len(ks) > 1 { ans = int(1e7) + 1 for i := 1; i < len(ks); i++ { ans = min(ans, ks[i]-ks[i-1]) } } fmt.Println(ans) } func min(a, b int) int { if a < b { return a } return b }