#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <stdlib.h>  
using namespace std;

int main(){
	vector <unsigned long long int> A;
	int N, temp, max;
	unsigned long long int res;
	cin>> N;
	max = N;
	while(N--){
		cin>>temp;
		A.push_back(temp);
	}
	sort(A.begin(), A.end());
	
	res = (A[max-1] - A[0]);
	
	if( res < 0){
		cout<< -res<<endl;
	}
	else
	cout << res<<endl;
	
}