#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, maxx = 0, minn = 0;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  maxx = *max_element(a, a + n);
  minn = *min_element(a, a + n);
  cout << maxx - minn << "\n";
  return 0;
}
