import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import Data.Bits
import Data.List
import Control.Monad

update :: VUM.IOVector Int -> B.ByteString -> IO () 
update vec bs
    | h == 'M' = VUM.modify vec (+1) 0
    | h == 'A' = VUM.modify vec (+1) 1
    | h == 'R' = VUM.modify vec (+1) 2
    | h == 'C' = VUM.modify vec (+1) 3
    | h == 'H' = VUM.modify vec (+1) 4
    | otherwise = VUM.modify vec (+1) 5
    where
        h = B.head bs

enum :: Int -> Int -> [Int]
enum n l
    | l == 0 = []
    | otherwise = (n .&. 1) : enum (shiftR n 1) (l - 1)

solve :: VU.Vector Int -> Int
solve vec = sum $ map (\i -> comb vec (enum i 5)) [0..2^len-1]
    where
        len = VU.length vec
        comb :: VU.Vector Int -> [Int] -> Int
        comb vec es
            | ones /=3 = 0
            | otherwise = foldl' step 1 (zip (VU.toList vec) es)
                where
                    ones = length $ filter (==1) es
                    step acc (v,b)
                        | b == 1 = acc * v
                        | otherwise = acc

main = do
    n <- readLn :: IO Int
    vec <- VUM.replicate 6 0
    forM_ [1..n] $ \i -> do
        bs <- B.getLine
        update vec bs 
    vec' <- VU.freeze vec
    print $ solve (VU.init vec')