package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func Scanner() string { sc.Scan() return sc.Text() } func main() { buf := make([]byte, 0) sc.Buffer(buf, 100000007) sc.Split(bufio.ScanWords) n, _ := strconv.Atoi(Scanner()) x := make([]int, n) inm := 1145141919810 for i := 0; i < n; i++ { x[i], _ = strconv.Atoi(Scanner()) } ans := inm sort.Ints(x) for i := 0; i < n-1; i++ { if x[i] == x[i+1] { continue } ans = min(ans, abs(x[i]-x[i+1])) } if ans == inm { ans = 0 } fmt.Println(ans) } func min(x int, y int) int { if x >= y { return y } else { return x } } func abs(n int) int { if n < 0 { return n * -1 } else { return n } }