f=input;N=f();f();n=[f()for _ in range(N)];print max(n)-min(n)