from itertools import combinations

n = int(eval(input()))

names = [input()[0] for _ in range(n)]

li = [0]*5

for i,c in enumerate("MARCH"):

	cnt = 0

	for name in names:

		if c == name:

			cnt += 1

	li[i] = cnt

ans = 0

for i,j,k in combinations(li,3):

	ans += i*j*k

print(ans)
n,*name=open(0)

n=int(n)

l=[0]*5

for c in name:

	x=c[0]

	if x=="M":

		l[0]+=1

	elif x=="A":

		l[1]+=1

	elif x=="R":

		l[2]+=1

	elif x=="C":

		l[3]+=1

	elif x=="H":

		l[4]+=1

from itertools import combinations

ans=0

for c in combinations(list(range(5)),3):

	ans+=l[c[0]]*l[c[1]]*l[c[2]]

print(ans)
from itertools import combinations

n = int(eval(input()))
names = [input()[0] for _ in range(n)]
li = [0] * 5
for i, c in enumerate("MARCH"):
    cnt = 0
    for name in names:
        if c == name:
            cnt += 1
    li[i] = cnt
ans = 0
for i, j, k in combinations(li, 3):
    ans += i * j * k
print(ans)

n, *name = open(0)
n = int(n)
l = [0] * 5
for c in name:
    x = c[0]
    if x == "M":
        l[0] += 1
    elif x == "A":
        l[1] += 1
    elif x == "R":
        l[2] += 1
    elif x == "C":
        l[3] += 1
    elif x == "H":
        l[4] += 1
from itertools import combinations

ans = 0
for c in combinations(list(range(5)), 3):
    ans += l[c[0]] * l[c[1]] * l[c[2]]
print(ans)

+n, *name = open(0) +n = int(n) +l = [0] * 5 +for c in name: +    x = c[0] +    if x == "M": +        l[0] += 1 +    elif x == "A": +        l[1] += 1 +    elif x == "R": +        l[2] += 1 +    elif x == "C": +        l[3] += 1 +    elif x == "H": +        l[4] += 1 -n = int(eval(input())) -names = [input()[0] for _ in range(n)] -li = [0] * 5 -for i, c in enumerate("MARCH"): -    cnt = 0 -    for name in names: -        if c == name: -            cnt += 1 -    li[i] = cnt -for i, j, k in combinations(li, 3): -    ans += i * j * k +for c in combinations(list(range(5)), 3): +    ans += l[c[0]] * l[c[1]] * l[c[2]]