import Control.Monad
import Data.List

main = do
    n <- readLn
    fs <- map length . group . sort . filter (`elem` "MARCH") . map head <$> replicateM n getLine
    let l = length fs
    print $ sum [(fs !! i) * (fs !! j) * (fs !! k)|i <- [0..l-3], j <- [i+1..l-2], k <- [j+1..l-1]]