#include <algorithm>
#include <iostream>
using namespace std;

int main(){
	int N, MAX=0, MIN=0;
	cin >> N;
	for(int i=0; i<N; i++){
		cin >> a;
		MAX = max(a, MAX);
		MIN = min(a, MIN);
	}
	cout << MAX - MIN << endl;
}