#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ma = -1, mi = 1001;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    ma = max(ma, a);
    mi = min(mi, a);
  }
  cout << ma - mi << endl;
  return 0;
}
