import Data.List

nPr :: Integral a => a -> a -> a
nPr n r = product [(n - r + 1)..n]

nCr :: Integral a => a -> a -> a
nCr n r = nPr n r `div` product [1..r]

main :: IO ()
main = do
    _ <- getLine
    s <- filter (`elem` "MARCH") . map head . lines <$> getContents
    let n = length s
        m = length . filter (==1) . map length . group . sort $ s
    print $ n `nCr` 3 - m