import Control.Monad import Data.List import Control.Applicative answer True = "YES" answer False = "NO" main = do n <- (read :: String -> Int) <$> getLine ss <- forM [1..n] $ \_ -> getLine let xs = reverse $ sort $ map length $ group $ sort ss putStrLn $ answer $ head xs - 1 <= (sum $ tail xs)