Main(require("fs").readFileSync("/dev/stdin", "utf8"));

function Main(input){
    var args = input.split('\n');
    var N = parseInt(args[0], 10);
    var a = args[1].split(' ').map(a => parseInt(a, 10)).sort( (a,b) => (a<b ? -1 : 1) );

    console.log(a[N-1]-a[0]);
}