N = int(input())
l = []
for i in range(N + 1):
    l.append(int(input()))
del l[0]
print(max(l) - min(l))