n = int(input()) a = list(map(int, input().split())) max_a = 0 min_a = 10**10 for i in range(n): for j in range(i+1, n): max_a = max(max_a, abs(a[i] - a[j])) min_a = min(min_a, abs(a[i] - a[j])) print(min_a) print(max_a)