T = int (input()) n = input().split() a = max(n,key=int) b = min (n,key=int) c = int(a)-int(b) print (c)