#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;


int main(){
  int N; cin >> N;
  int min = 1000; max = 0;
  for(int i = 0; i > N; i++){
    int tmp;
    cin >> tmp;
    if(tmp < min) tmp = min;
    if(tmp > max) tmp = max;
  }
  cout << max - min << endl;
}
