function Main(input) {
    line = input.split('\n');
    var n = parseInt(line[0]);
    a = line[1].split(' ').map((n) => parseInt(n));
    var ma = -100;
    for (let i = 0; i < n; i++)
        for (let j = i + 1; j < n; j++)
            ma = Math.max(ma, Math.abs(a[i] - a[j]));
    console.log(ma);
}

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