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