n=gets.to_i;a=[*$<] puts a.map{|e|a.count e}.max*2>n+1?:NO:'YES'