import           Control.Monad (forM, replicateM)
import           Data.List     (groupBy, sort)

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

process = map length .
          groupBy (\(a:_) (b:_) ->  a == b) .
          sort . filter (\(s:_) -> s `elem` "MARCH")

solve ls = let n = length ls
               bs = map (map fst . filter snd . zip [0..])
                   $ filter (\ss -> 3 == length (filter id ss))
                   $ replicateM n [True, False]
           in
               sum $ map (product . map (ls !!)) bs

