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