import Control.Monad

main = do
  n <- read <$> getLine
  s <- forM [1..n] $ \t ->
    head <$> getLine
  putStrLn . show . solve $ s

solve :: String -> Int
solve s = 
  let m = length $ filter (== 'M') s
      a = length $ filter (== 'A') s
      r = length $ filter (== 'R') s
      c = length $ filter (== 'C') s
      h = length $ filter (== 'H') s
  in sum $ map product $ comb 3 [m,a,r,c,h]


comb :: Int -> [a] -> [[a]]
comb 0 _ = [[]]
comb _ [] = []
comb m (x:xs) = map (x:) (comb (m-1) xs) ++ comb m xs

