function Main(input){
    input = input.split("\n");
    var k = 0;
    while(1){
        var n = parseInt(input[k++],10);
        if(n == 0)
            break;

        input[k] = input[k].split(" ");

        var min = 1000000000;
        for(var i = 0;i < n;i++){
            for(var j = i + 1;j < n;j++){
                var a = Math.abs(parseInt(input[k][i],10) - parseInt(input[k][j],10));
                if(min > a)
                    min = a;
            }
        }
        console.log(min);
        k++;
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));