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