#include <bits/stdc++.h>
using namespace std;

int main() {
int n,i,x;
cin >> n;
int number[n];
for (i = 1;  i <= n; i++)
{
cin >> number[i];
}

int max,min= 0;
max = min = number[0];
/
for(x = 1; x <= n; x++)
{
if(number[x] > max)
max = number[x];
if(number[x] < min)
min = number[x];

}
cout << max-min<< endl;
}


