n=int(input()) a=sorted(list(map(int,input().split()))) print(min([abs(a[i+1]-a[i]) for i in range(len(a)-1)])) print(abs(max(a)-min(a)))