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