n = int(input()) a = list(map(int, input().split())) a.sort() b = [a[i + 1] - a[i] for i in range(n - 1)] print(f"{min(b)}\n{a[n-1]-a[0]}")