import Control.Applicative

main :: IO ()
main = do
  getLine
  ss <- lines <$> getContents
  putStrLn $ show $ solve ss

solve :: [String] -> Int
solve ss = choose 3 $ filter (/= 0) $ length' ss "MARCH"

choose :: Int -> [Int] -> Int
choose _ []      = 0
choose 1 (n:ns)  = n + choose 1 ns
choose n' (n:ns) = n * (choose (n' - 1) ns) + choose n' ns

length' :: [String] -> String -> [Int]
length' _ []      = []
length' ss (c:cs) = (length (filter' (== c) ss)) : (length' (filter' (/= c) ss) cs)
  where
    filter' v = filter (v . head)
