#!/usr/bin/ruby
# -*- coding: utf-8 -*-

while true do
    # n??????
    n = gets.to_i
    break if n == 0 # 0?????¨????????????
    v = gets.split(" ").map{|vstr| vstr.to_i}.sort
    dv = []
    (v.length - 1).times do |i|
        dv.push(v[i+1] - v[i])
    end
    puts dv.min
end