import qualified Data.Map.Strict as M
import Data.List
import Control.Monad

count :: [Char] -> M.Map Char Int
count = foldl' step $ M.fromList [(ini, 0) | ini <- "MARCH"]
  where step tbl ch
          | ch `elem` "MARCH" = M.adjust (1+) ch tbl
          | otherwise = tbl

choices :: [[Char]]
choices = nub $ map (sort . take 3) $ permutations "MARCH"

patterns :: M.Map Char Int -> Int
patterns tbl = sum [ product $ map (tbl M.!) l
                   | l <- choices ]

main :: IO ()
main = do
  n <- readLn
  ss <- replicateM n getLine
  let table = count $ map head ss
  print $ patterns table
