n=gets.to_i
a=n.times.map{gets}
puts a.uniq.map{|s|a.count(s)}.max>(n+1)/2?:NO: :YES