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