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