n=int(eval(input()))

a=[list(eval(input()))for i in range(n)]

d={'M':0,"A":0,"R":0,'C':0,'H':0}

for i in a:

    if i[0] in d:

        d[i[0]]+=1

dl=[]

for i in list(d.values()):

    dl.append(i)

ans=0

for i in range(3):

    for j in range(i+1,4):

        for k in range(j+1,5):

            ans+=dl[i]*dl[j]*dl[k]

print(ans)
n=int(eval(input()))

d={}

for i in range(n):

    a=eval(input())

    if a[0]=="M" or a[0]=="A" or a[0]=="R" or a[0]=="C" or a[0]=="H":

        d[a[0]]=d.get(a[0],0)+1

a=list(d.values())

if len(a)<3:

    print((0))

    exit()

import itertools

c=list(itertools.combinations(a,3))

ans=0

for i,j,k in c:

    ans+=i*j*k

print(ans)
n = int(eval(input()))
a = [list(eval(input())) for i in range(n)]
d = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for i in a:
    if i[0] in d:
        d[i[0]] += 1
dl = []
for i in list(d.values()):
    dl.append(i)
ans = 0
for i in range(3):
    for j in range(i + 1, 4):
        for k in range(j + 1, 5):
            ans += dl[i] * dl[j] * dl[k]
print(ans)

n = int(eval(input()))
d = {}
for i in range(n):
    a = eval(input())
    if a[0] == "M" or a[0] == "A" or a[0] == "R" or a[0] == "C" or a[0] == "H":
        d[a[0]] = d.get(a[0], 0) + 1
a = list(d.values())
if len(a) < 3:
    print((0))
    exit()
import itertools

c = list(itertools.combinations(a, 3))
ans = 0
for i, j, k in c:
    ans += i * j * k
print(ans)

-a = [list(eval(input())) for i in range(n)] -d = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} -for i in a: -    if i[0] in d: -        d[i[0]] += 1 -dl = [] -for i in list(d.values()): -    dl.append(i) +d = {} +for i in range(n): +    a = eval(input()) +    if a[0] == "M" or a[0] == "A" or a[0] == "R" or a[0] == "C" or a[0] == "H": +        d[a[0]] = d.get(a[0], 0) + 1 +a = list(d.values()) +if len(a) < 3: +    print((0)) +    exit() +import itertools + +c = list(itertools.combinations(a, 3)) -for i in range(3): -    for j in range(i + 1, 4): -        for k in range(j + 1, 5): -            ans += dl[i] * dl[j] * dl[k] +for i, j, k in c: +    ans += i * j * k