N=int(input()) X=list(map(int,input().split())) print(max(X)-min(X))