n=int(input())
a = list(map(int, input().split()))
s=max(a)-min(a)
print(s)