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