input_data = gets.chomp.to_i
n = input_data

while n != 0 do 
    g = gets.chomp.split(" ")
    a = g.map{|v| v.to_i}
    
    array = []
    (0..(n-2)).each do |i|
        ((i+1)..(n-1)).each do |j|
            array.push((a[i] - a[j]).abs)
        end
    end
    
    p array.min
    input_data = gets.chomp.to_i
    n = input_data
end
