#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  int small = 0, big = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x < small)
      small = x;
    else if (x > big)
      big = x;
  }
  cout << big - small << endl;
  return 0;
}
