#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  int mx = *max_element(v.begin(), v.end());
  int mn = *min_element(v.begin(), v.end());
  cout << (mx - mn);
}
