N=int(input()) B=input() L=[] for i in range(N): L.append(int(input())) W=sorted(L) print(W[N-1]-W[0])