"use strict"

function main(input) {

    input = input.split('\n')
    let nums = input[1].split('\n')
    nums.map(x => += x)

    console.log(Math.max(nums) - Math.min(nums))



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