const config = {
    input: '/dev/stdin',
    newline: '\n'
};

const line = require('fs').readFileSync(config.input, 'utf-8').split(config.newline);

const arr = line.slice(1, line.length-1)
                .map(x => parseInt(x))
                .reverse()
                .reduce((acc, x, i, arr) => acc.concat(arr.slice(i+1).map(y => x - y)), [])
                .reduce((acc, x) => acc < x ? x : acc);

console.log(arr);
