{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           GHC.Base
import           System.IO

import qualified Data.Array    as A
import qualified Data.IntMap   as I
import           Data.List
import qualified Data.Map      as M
import qualified Data.Set      as S
import qualified Data.Vector   as V

-- for Vector
count :: (a -> Bool) -> V.Vector a -> Int
count p = V.length . V.filter p

-- main
main :: IO ()
main = march

march :: IO ()
march = do
  n  :: Int <- readLn
  ss :: V.Vector T.Text <- V.replicateM n T.getLine
  let m = count (\s -> T.head s == 'M') ss
      a = count (\s -> T.head s == 'A') ss
      r = count (\s -> T.head s == 'R') ss
      c = count (\s -> T.head s == 'C') ss
      h = count (\s -> T.head s == 'H') ss
      rc = r + c
      ma = m + a
  print $ m * a * (rc + h) + r * c * (ma + h) + h * rc * ma