import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Data.List
import Debug.Trace

-- or readInteger
readInts :: B.ByteString -> [Int]
readInts = map (fst . fromJust . B.readInt) . B.words

getInts :: IO [Int]
getInts = liftM readInts B.getLine

f n [] = 1
f n (x:xs) = c n x * f (n-x) xs
  where c n m = product [1..n] `div` product [1..m] `div` product [1..(n-m)]
g :: String -> [Int]
g = map length . group . sort

main = do
  s <- getLine
  print $ (f (length s) $ g s) - 1