N = int(input()) G = input() l = sorted([int(input()) for x in range(N)]) print(l[-1] - l[0])