#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  vector<int> a;
  vector<int> a2;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a2.push_back(a[i]);
  }
  sort(a2.begin(), a2.end());
  int absa = abs(a2.front() - a2.back());
  cout << absa << endl;
}
