#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <cmath>
#include <utility>
#define Maxn 100005
#define Maxm 1000005
#define lowbit(x) x&(-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1.0)
#define LL long long 
#define Inf (1LL<<62)
#define inf 0x3f3f3f3f
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
using namespace std;
int main()
{
	int arr[1005];
	while(cin>>n)
	{
		int _min=inf,_max=-1;
		for(int i=0;i<n;i++)
		{
			cin>>arr[i];
			_min=min(_min,arr[i]);
			_max=max(_max,arr[i]);
		}
		cout<<_max-_min<<endl;
	}
	return 0;
}