function Main(input) {
    line = input.split('\n');
    var n = parseInt(line[0]);
    var a = line[1].split(' ').map((n) => Number(n));

    var ma = -100, mi = 1000000001;
    for (let i = 0; i < n; i++) {
        ma = Math.max(ma, a[i]);
        mi = Math.min(mi, a[i]);
    }

    console.log(ma - mi);
}

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