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 main() { var n = parseInt(readLine()); a = readLine().split(' '); a = a.map(Number); a = a.sort(function(x, y) { if (x < y) { return -1; } else { return 1; } }); var minAbsDiff = Math.abs(a[0] - a[1]); var i = 1; var right, left, x, y; while (i < n) { left = a[i]; right = a[i + 1]; if ((i + 1) >= n) { break; } y = Math.abs(left - right); minAbsDiff = Math.min(minAbsDiff, y); i++; } console.log(minAbsDiff); }