import Data.List factorial :: Int -> Integer factorial n = fromIntegral $ product [1..n] main = do str <- getLine >>= return . map length . group . sort print $ factorial (sum str) `div` (product (map factorial str)) - 1