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

int main()
{
  int n;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int m = *min_element(a, a+n);
  int M = *max_element(a, a+n);
  cout << M-m << endl;
  return 0;
}
