import qualified Data.Set as S

main = do
  a <- getLine
  print $ solve S.empty a
 
solve _ [_] = 1
solve s (x:xs)  = solve s' xs + length (filter p xs)
  where
    s' = S.insert x s
    p x = S.notMember s