N=int(input()) input() n=[] for i in range(N): n.append(int(input())) print(max(n)-min(n))