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