import Control.Monad
import qualified Data.Map as M

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

solve :: [String] -> Int
solve = calc . count . filter (`elem` "MARCH") . map head
  where
    count   = foldr (\k mp -> M.insertWith (+) k 1 mp) m0
    m0      = M.fromList $ zip "MARCH" $ repeat 0
    calc mp = sum [ mp M.! x * mp M.! y * mp M.! z | [x, y, z] <- ks ]
    ks      = [ "MAR", "MAC", "MAH", "MRC", "MRH"
              , "MCH", "ARC", "ARH", "ACH", "RCH"]
