from itertools import*;print((sum(p*q*r for p,q,r in list(combinations([len(list(v))for k,v in groupby(sorted(s[0]for s in open(0).readlines()[1:]))if k in"MARCH"],3)))))
from itertools import*;x=[s[0]for s in open(0).readlines()];print((sum(p*q*r for p,q,r in combinations([x.count(s)for s in"MARCH"],3))))
from itertools import *

print(
    (
        sum(
            p * q * r
            for p, q, r in list(
                combinations(
                    [
                        len(list(v))
                        for k, v in groupby(
                            sorted(s[0] for s in open(0).readlines()[1:])
                        )
                        if k in "MARCH"
                    ],
                    3,
                )
            )
        )
    )
)

from itertools import *

x = [s[0] for s in open(0).readlines()]
print((sum(p * q * r for p, q, r in combinations([x.count(s) for s in "MARCH"], 3))))

-print( -    ( -        sum( -            p * q * r -            for p, q, r in list( -                combinations( -                    [ -                        len(list(v)) -                        for k, v in groupby( -                            sorted(s[0] for s in open(0).readlines()[1:]) -                        ) -                        if k in "MARCH" -                    ], -                    3, -                ) -            ) -        ) -    ) -) +x = [s[0] for s in open(0).readlines()] +print((sum(p * q * r for p, q, r in combinations([x.count(s) for s in "MARCH"], 3))))