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