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