{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BS
import qualified Data.Map.Strict       as M

main :: IO ()
main = do
  n <- readLn
  ss <- BS.lines <$> BS.getContents
  print $ solve n ss

solve :: Int -> [BS.ByteString] -> Int
solve _ ss = sum [M.findWithDefault 0 x cs * M.findWithDefault 0 y cs * M.findWithDefault 0 z cs
                 | x <- "MARCH"
                 , y <- "MARCH"
                 , z <- "MARCH"
                 , x /= y
                 , y /= z
                 , z /= x] `div` 6 where
  cs = M.fromListWith (+) [(BS.head s, 1) | s <- ss]
