n = gets.to_i xs = gets.split(' ').map(&:to_i) xs.sort!.uniq! size = xs.size if size <= 1 puts 0 exit end a = 9999999999 (size - 1).downto(1) do |i| d = (xs[i] - xs[i - 1]).abs a = d if a > d end puts a