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