n = int(input()) *a, = map(int,input().split()) M = max(a) - min(a) m = min(i-j for i,j in zip(a[1:],a)) print(m) print(M)