puts gets.to_i+1<(a=*$<).map{|e|a.count e}.max*2?:NO:'YES'