import * as fs from 'fs'; const input = fs.readFileSync('/dev/stdin', 'utf8'); const data = input.split('\n'); const N = parseInt(data[0]); const xs = data[1].split(' ').map(s => parseInt(s)); xs.sort(); let min = undefined; for (let i = 1; i < xs.length; i++) { if (xs[i - 1] !== xs[i]) { min = Math.min(min ?? 1000000, Math.abs(xs[i - 1] - xs[i])); } } console.log(min ?? 0);