import Control.Applicative import Data.List fact 1 = 1 fact n = n * fact (n-1) main = do s <- getLine print $ (fact.length $ s) `div` (product . map (fact.length) . group . sort $ s) - 1