"use strict"

function main(input) {

    input = input.split('\n')
    input = input[1].split(' ').map(Number)
    input.sort()

    console.log(input[0] - input[input.length - 1])


}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));