n = int(input()) k=input() array = [] for i in range(n): array.append(int(input())) print(max(array) - min(array))