import itertools N = int(input().strip()) lst = input().strip().split(' ') mmin = 0 mmax = 0 for i in itertools.combinations(lst, r=2): a, b = int(i[0]), int(i[1]) a, b = min(a, b), max(a, b) #print('a:{} b:{}'.format(a, b)) if (mmin == 0) or (mmin > b - a): mmin = b - a if (mmax == 0) or (mmax < b - a): mmax = b - a print(mmin) print(mmax)