import           Control.Monad
import           Data.List
import           Debug.Trace

main :: IO ()
main = do
  n <- readLn :: IO Int
  ss <- replicateM n $ head <$> getLine
  print $ solve ss

solve ss = let ss' = filter (\a -> head a `elem` "MARCH")
                 $ groupBy (==) $ sort ss
               xs = filter ((== 3) . length) $ f ss'
           in
             sum $ map product xs

f [] = []
f [x] = [[length x], []]
f (h:t) = let ts = f t
          in (map (length h :) ts) ++ ts
