class Yukicoder def initialize n = gets.chomp.to_i hash = Hash.new(0) n.times do eto = gets.chomp hash[eto] += 1 end hash = hash.sort_by{|k,v| -v}.to_h.values if hash[0] > (n/2.0).ceil puts "NO" else puts "YES" end end end Yukicoder.new