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