function Main(input) {
    var NA = input.split('\n');
    var N = parseInt(NA[0]);
    var A = NA[1].split(' ').map(n => parseInt(n)).sort();

    console.log(Math.abs(A[0] - A[A.length-1]));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));