import itertools as i;d=[0]*91

for _ in[0]*int(eval(input())):d[ord(input()[0])]+=1

print((sum(d[p]*d[q]*d[r]for p,q,r in i.combinations(list(map(ord,'MARCH')),3))))
import itertools as i,collections as c

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

b=c.Counter(s[0]for s in a if s[0]in"MARCH")

print((sum(p*q*r for p,q,r in i.combinations(list(b.values()),3))))
import itertools as i

d = [0] * 91
for _ in [0] * int(eval(input())):
    d[ord(input()[0])] += 1
print(
    (sum(d[p] * d[q] * d[r] for p, q, r in i.combinations(list(map(ord, "MARCH")), 3)))
)

import itertools as i, collections as c

n, *a = open(0).read().split()
b = c.Counter(s[0] for s in a if s[0] in "MARCH")
print((sum(p * q * r for p, q, r in i.combinations(list(b.values()), 3))))

-import itertools as i +import itertools as i, collections as c -d = [0] * 91 -for _ in [0] * int(eval(input())): -    d[ord(input()[0])] += 1 -print( -    (sum(d[p] * d[q] * d[r] for p, q, r in i.combinations(list(map(ord, "MARCH")), 3))) -) +n, *a = open(0).read().split() +b = c.Counter(s[0] for s in a if s[0] in "MARCH") +print((sum(p * q * r for p, q, r in i.combinations(list(b.values()), 3))))