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[a.length - 1] - a[0]; let min = Number.POSITIVE_INFINITY; for (let i = 0; i < a.length - 1; i++) { min = Math.min(min, a[i + 1] - a[i]); } console.log(min); console.log(max);