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

int main() {
	int N, a[100];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N);
	cout << a[N - 1] - a[0] << endl;
}