#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (auto& ai : a) cin >> ai;
  int min = *min_element(a.begin(), a.end());
  int max = *max_element(a.begin(), a.end());
  cout << max - min << endl;
  return 0;
}
