i = int(input()) list1 = list(map(int, input().split())) n = max(list1) m = min(list1) s = n - m print(s)