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