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