N=int(input()) a=sorted(list(map(int,input().split()))) m,M=a[1]-a[0],a[-1]-a[0] for i in range(N-1): if a[i]==a[i+1]: m=0 print(m) print(M)