{-# LANGUAGE BangPatterns #-}
import Control.Applicative((<$>))
import Control.Monad
import Data.Map ((!))
import qualified Data.Map as M
import qualified Data.List as L
import Data.Maybe (catMaybes)
-- import qualified Data.Char as C
-- import qualified Data.IntSet as I
import Debug.Trace
-- import Text.Regex.Posix ((=~))
--------------------------------------------
readInt    = read :: String -> Int
getInt     = readInt <$> getLine
getIntList = map readInt . words <$> getLine
int2bin 0 =  []
int2bin n =  n `mod` 2 : int2bin (n `div` 2)
----------------------------------------------

data Recode = Recode {
                m :: Int,
                a :: Int,
                r :: Int,
                c :: Int,
                h :: Int } deriving Show

counter rr [] = rr
counter rr@(Recode m a r c h) (s:ss)
  | head s == 'M' = counter (Recode (m+1) a r c h) ss
  | head s == 'A' = counter (Recode m (a+1) r c h) ss
  | head s == 'R' = counter (Recode m a (r+1) c h) ss
  | head s == 'C' = counter (Recode m a r (c+1) h) ss
  | head s == 'H' = counter (Recode m a r c (h+1)) ss
  | otherwise = counter rr ss

main :: IO ()
main = do
  n <- getInt
  ss <- replicateM n getLine
  let Recode m a r c h = counter (Recode 0 0 0 0 0) ss
  print $ m*a*r + m*r*c + m*c*h + m*a*c + m*a*h + m*r*h + a*r*c + a*r*h + a*c*h + r*c*h
