const lines = require('fs') .readFileSync('/dev/stdin', 'utf-8') .trim().split('\n').values(); const N = Number(lines.next().value); const a = lines.next().value.split(' ').map(x => Number(x)); let max = a[N - 1] - a[0]; let min = Number.POSITIVE_INFINITY; for (let i = 0; i < N - 1; i++) { min = Math.min(min, a[i + 1] - a[i]); } console.log(min); console.log(max);