class Calc0135 def initialize(args) args = args.map { |l| l.chomp.split(/\s+/) } @n = args.shift.first.to_i @xs = args.shift.map(&:to_i) end def run xs = @xs.uniq if xs.size == 1 0 else xs.sort.each_cons(2).map { |x1, x2| x2 - x1 }.min end end end puts Calc0135.new(STDIN.readlines).run if __FILE__ == $0