N=int(input()) a=[int(i) for i in input().split()] res=10**6 for i in range(N-1): res=min(res,a[i+1]-a[i]) print(res) print(a[-1]-a[0])