N = int(input()) points = list({int(x) for x in input().split()}) min_distance = -1 if len(points) < N: min_distance = 0 minp1 = points[0] minp2 = points[1] maxp = points[0] for i in points[1:]: if i < minp1: minp2 = minp1 minp1 = i maxp = max(i,maxp) if min_distance: min_distance = minp2 - minp1 max_distance = maxp - minp1 print(min_distance) print(max_distance)