m = int(input())
n = list(map(int,input().split()))
n.sort()
max_dif = n[-1]-n[0]
print(max_dif)