fuck = input() nums = list(map(int,input().split())) max = max(nums) min = min(nums) print(max - min)