N = int(input()) a = list(map(int, input().split())) a.sort() b = [] for i in range(N-1): b.append(a[i+1]-a[i]) print(min(b)) print(a[N-1] - a[0])