n=int(input()) a=sorted(list(map(int,input().split()))) ans=1e9 for i in range(1,n): ans=min(ans,a[i]-a[i-1]) print(ans) print(a[-1]-a[0])