// No.716 距離 package main import ( "bufio" "fmt" "os" "sort" "strconv" ) func main() { var sc = bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) nextInt := func() int { sc.Scan() i, _ := strconv.Atoi(sc.Text()) return i } var n = nextInt() var a = make([]int, n) for i := 0; i < n; i++ { a[i] = nextInt() } sort.Ints(a) minDiff := a[1] - a[0] for j := 1; j < n; j++ { minDiff = min(minDiff, a[j]-a[j-1]) } fmt.Println(minDiff) fmt.Println(a[len(a)-1] - a[0]) }