n = int(raw_input()) raw_input() lst = [] for i in range(0, n): lst.append(int(raw_input())) lst.sort() print lst[-1] - lst[0]