size_number = input()
a = map(int, raw_input().split())
max = -1000
min = 99999
for i in range(size_number):
    if(max < a[i]):
        max = a[i]
    if(min > a[i]):
        min = a[i]
print(max - min)
