abses = []

loop do
  n = gets.to_i
  break if n.zero?

  as = gets.split.map(&:to_i)
  min_abs = 1_001_001_001

  as.combination(2) do |a|
    min_abs = [min_abs, a.inject(:-).abs].min
  end

  abses << min_abs
end

abses.each do |abs|
  p abs
end

