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

while (line = lines.shift()) {
    const numbers = line.split(' ').map(Number);
    let length = numbers[0];
    if(length == 0) break;
    let arr = numbers.slice(1,length+1);
    let min; 
    let min2;
    for(let i = 0; i<length; i++){
        arr.forEach((key, index, arr) => {
            if(key == i) continue;
            if(arr[key] > arr[i]){
                min2 = arr[key] - arr[i];
            } else {
                min2 = arr[i] - arr[key];
            }
        
            if(i == 0){
                min = min2;
                continue;
            } 
        
            if(min > min2) min = min2;
        })
        
         }
    


    console.log(min);
}
