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;
    }
    index ++;
} 
 
