n = int(input()) min = 1000; max = 1 group = input() for i in range(n): j = int(input()) if j > max: max = j if j < min: min = j print(max - min)