function main(input) {
    var min=Math.pow(10,10), max=-1;
    var list = input[1].split(" ").map(v=>v-0).forEach(v=>{
        min = Math.min(min, v);
        max = Math.max(max, v);
    });
    console.log(max-min);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
