{-# 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

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

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