from itertools import*;print((sum(p*q*r for p,q,r in combinations(list(map(list(zip(*open(0).readlines()))[0].count,'MARCH')),3))))
from itertools import*

n,*a=open(0).read().split()

print((sum(p*q*r for p,q,r in combinations(list(map([i[0]for i in a].count,"MARCH")),3))))
from itertools import *

print(
    (
        sum(
            p * q * r
            for p, q, r in combinations(
                list(map(list(zip(*open(0).readlines()))[0].count, "MARCH")), 3
            )
        )
    )
)

from itertools import *

n, *a = open(0).read().split()
print(
    (
        sum(
            p * q * r
            for p, q, r in combinations(list(map([i[0] for i in a].count, "MARCH")), 3)
        )
    )
)

+n, *a = open(0).read().split() -            for p, q, r in combinations( -                list(map(list(zip(*open(0).readlines()))[0].count, "MARCH")), 3 -            ) +            for p, q, r in combinations(list(map([i[0] for i in a].count, "MARCH")), 3)