process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function sortNumber(a,b) { return a - b; } function main() { var n = parseInt(readLine()); a = readLine().split(' '); a = a.map(Number); // your code goes here if (n < 2 || n > 100000) { console.log("n is out of range"); return; } for (var i = 0; i < n; i ++) { if (a[i] < -10e9 || a[i] > 10e9) { console.log("number out of range: ", a[i], ":", -10e9); return; } } var minAbs = 30e9; a.sort(sortNumber); for (var i = 0; i < n-1; i++) { var abs = Math.abs(a[i] - a[i+1]); if (abs < minAbs) { minAbs = abs; } } console.log(minAbs); }