const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');

var n = null;
var index = 0;
while (line = lines.shift()) {
    const isN = index % 2 === 0;
    const numberArray = line.split(' ').map(Number);

    if(isN){
        n = numberArray[0];
    } else {
        var smallestScore = null;
        for(var i = 0; i < numberArray.length; i++){
            for(var j = 0; j < numberArray.length; j++){
                if (i!==j) {
                    let scoreDifference = Math.abs(numberArray[i] - numberArray[j]);
                    if(smallestScore === null){
                        smallestScore = scoreDifference;
                    } else {
                        if(scoreDifference < smallestScore){
                           smallestScore = scoreDifference; 
                        }
                    }
                }
            }    
        }
        console.log(smallestScore);
        n = null;
    }
    // const [n, max] = line.split(' ').map(Number);
    // if (n === 0 && max === 0) {break;}
    // let prices = lines.shift().split(' ').map(Number);

    // // write something here

    // if(isN){
    //     m
    // }

    // console.log(...);
    index ++;
} 

/*const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');
while (line = lines.shift()) {
    const [n, max] = line.split(' ').map(Number);
    if (n === 0 && max === 0) {break;}
    let prices = lines.shift().split(' ').map(Number);

    console.log('HEY');
    // write something here

    // console.log(...);
} 
*/
