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

const int MAX_N = 100;
int n, a[MAX_N];
int MAX = 0, MIN = 1000;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];

	for (int i = 0; i < n; i++) {
		if (a[i] > MAX) max = a[i];
		if (a[i] < MIN) min = a[i];
	}

	cout << MAX - MIN << endl;
	return 0;
}