#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int a[100];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	sort(a, a + N);
	cout << a[N - 1] - a[0] << endl;
}