import Control.Monad
import Data.List
main = do
    n <- readLn::IO Int
    xs <- replicateM n getLine 
    let matchEachLen xs = (map (\x -> length x) . group . sort . conditionMap) xs 
        notSingle xs = if  product (matchEachLen xs) == 1 
                           then 1  
                           else (product . filter ( /= 1) . matchEachLen) xs
        single xs = (sum . filter ( == 1) . matchEachLen) xs
        ans xs = if (product . matchEachLen ) xs == 1
                    then (comb (single xs) 3)
                    else comb (length $ matchEachLen xs) 3 * (notSingle xs) - (comb (single xs) 3)

    print $ ans xs


conditionMap::[String] -> [Char]
conditionMap xs = map (!!0) $ filter(\x -> any (== x!!0) cond) xs 
    where cond = ['M','A','R','C','H']


comb ::Int -> Int -> Int
comb n k = (product[1..n]) `div` ((product[1..(n-k)]) * (product[1..k]))
