#include <iostream>
using namespace std;
int main()
{
int n, a;
cin >> n;
int maxa = 0, mina = 9999999;
while (n--)
{
cin >> a;
if (a > maxa)
maxa = a;
if (a < mina)
mina = a;
}
cout << maxa - mina;
return 0;
}