N = int(input()) input() n = [int(input()) for i in range(N)] print(max(n) - min(n))