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