_n = gets.to_i x = gets.split.map(&:to_i).uniq.sort ans = Float::INFINITY x.each_cons(2) { |i, j| ans = [j - i, ans].min } puts x.size == 1 ? 0 : ans