input() Case = tuple(map(int, input().split())) print(max(Case)-min(Case))