n = int(input()) a = list(map(int, input().split())) mn = 10 ** 6 mx = 0 for i, ei in enumerate(a): for j, ej in enumerate(a): if i == j: continue d = abs(ei - ej) mn = min(mn, d) mx = max(mx, d) print(mn) print(mx)