while true
    n = gets.to_i
    break if n == 0
    arr = gets.chomp.split.map(&:to_i).sort
    min = nil
    for i in 1..n-1
        min = (arr[i] - arr[i - 1]).abs if min.nil? || min > (arr[i] - arr[i - 1]).abs
    end
    puts min
end
