
int N, A, min = 1001, max = 01;
int main(){
    std::cin >> N;
    for(int i = 1; i <= N; i++){
        std::cin >> A;
        if(min > A) min = A;
        if(max < A) max = A;
    }
    std::cout << max -min <<  std::endl;
    return 0;
}