n = int(input()) a = list(map(int, input().split() ) ) ma = max(a) #max函数 mi = min(a) #min函数 print(ma-mi)