#include<iosteram>
#include<stdio.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    int house[n];
    int min = 0;
    int max = 0;
    for(int i = 0; i < n; i++){
        cin >> house[i];
        if(i == 0){
            min = house[0];
            max = house[0];
        }
        else {
            if(min > house[0]) min = house[0];
            if(max < house[0]) max = house[0];
        }
    }
    cout << max - min << endl;
}