n = int(input()) a = list(map(int, input().split())) d = [] for i in range(n): b = a[:] c = b.pop(i) for j in b: d.append(abs(c-j)) print(min(d)) print(max(d))