n = gets.to_i e = STDIN.map(&:chomp) h = Hash.new(0) e.each{|x| h[x] += 1 } if n >= h.values.max * 2 - 1 puts "YES" else puts "NO" end