https://www.luogu.com.cn/problem/P5724
"""
P5724 【深基4.习5】求极差 最大跨度值
https://www.luogu.com.cn/problem/P5724
"""
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=a[n-1]-a[0]
print(ans)
https://www.luogu.com.cn/problem/P5724
"""
P5724 【深基4.习5】求极差 最大跨度值
https://www.luogu.com.cn/problem/P5724
"""
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=a[n-1]-a[0]
print(ans)