import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.List
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
  n <- getInt
  ss <- replicateM n BS.getLine

  let countMarch :: Int -> Int -> Int -> Int -> Int -> [BS.ByteString] -> [Int]
      countMarch m a r c h [] = [m,a,r,c,h]
      countMarch m a r c h (s:ss') = case BS.index s 0 of
        'M' -> countMarch (m+1) a r c h ss'
        'A' -> countMarch m (a+1) r c h ss'
        'R' -> countMarch m a (r+1) c h ss'
        'C' -> countMarch m a r (c+1) h ss'
        'H' -> countMarch m a r c (h+1) ss'
        _   -> countMarch m a r c h ss'

      march = countMarch 0 0 0 0 0 ss

      ans = sum $ fmap
            (\(i, j, k) -> (march !! i) * (march !! j) * (march !! k))
            [(x, y, z) | x <- [0..2], y <- [(x+1)..3], z <- [(y+1)..4]]

  print ans