n = int(input()) seq = input().split() int_seq = [int(i) for i in seq] result = max(int_seq) - min(int_seq) print(result)