#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, max, min;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) a[i];
  max = *max_element(a.begin(), a.end());
  min = *min_element(a.begin(), a.end());
  cout << max - min << endl;
  return 0;
}
