module Main where

import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B

f bs [m, a, r, c, h] = case B.head bs of
    'M' -> [m + 1, a, r, c, h]
    'A' -> [m, a + 1, r, c, h]
    'R' -> [m, a, r + 1, c, h]
    'C' -> [m, a, r, c + 1, h]
    'H' -> [m, a, r, c, h + 1]
    _   -> [m, a, r, c,     h]

main :: IO ()
main = do
    n <- readLn
    ss <- replicateM n B.getLine
    let as = filter (>= 1) $ foldr f [0, 0, 0, 0, 0] ss
    let c3 = filter ((== 3) . length) (subsequences as)
    let ans = sum $ fmap product c3
    print ans