var main = function main(input) {
    var N = +input.split('\n')[0]
    var A = input.split('\n')[1].split(' ')
    var min = 100000000
    var max = 1

    for (var i = 0; i < N; i++) {
        if (+A[i] > max) max = +A[i]
        if (+A[i] < min) min = +A[i]
    }
    console.log(max - min)
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf-8'))
