n=int(eval(input()))

A=["M","A","R","C","H"]

B=[0,0,0,0,0]

s=[]

for i in range(n):

    S=eval(input())

    if S[0] in A:

        s.append(S)

#print(s)

for i in s:

    for j in range(5):

        if A[j]==i[0]:

            B[j]+=1

            break

c=B.count(0)

if c>2:

    print((0))

else:

    c=0

    for i in range(3):

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

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

                c+=(B[i]*B[j]*B[k])

    print(c)

#print(B)

import itertools

n=int(eval(input()))

s=dict()

for i in ["M","A","R","C","H"]:

    s[i]=0

for i in range(n):

    _s=eval(input())

    if _s[0] in ["M","A","R","C","H"]:

        s[_s[0]]+=1

s=list(s.items())

ans=0

for i in range(5):

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

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

            ans+=(s[i][1]*s[j][1]*s[k][1])

print(ans)
n = int(eval(input()))
A = ["M", "A", "R", "C", "H"]
B = [0, 0, 0, 0, 0]
s = []
for i in range(n):
    S = eval(input())
    if S[0] in A:
        s.append(S)
# print(s)
for i in s:
    for j in range(5):
        if A[j] == i[0]:
            B[j] += 1
            break
c = B.count(0)
if c > 2:
    print((0))
else:
    c = 0
    for i in range(3):
        for j in range(i + 1, 4):
            for k in range(j + 1, 5):
                c += B[i] * B[j] * B[k]
    print(c)
# print(B)

import itertools

n = int(eval(input()))
s = dict()
for i in ["M", "A", "R", "C", "H"]:
    s[i] = 0
for i in range(n):
    _s = eval(input())
    if _s[0] in ["M", "A", "R", "C", "H"]:
        s[_s[0]] += 1
s = list(s.items())
ans = 0
for i in range(5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            ans += s[i][1] * s[j][1] * s[k][1]
print(ans)

+import itertools + -A = ["M", "A", "R", "C", "H"] -B = [0, 0, 0, 0, 0] -s = [] +s = dict() +for i in ["M", "A", "R", "C", "H"]: +    s[i] = 0 -    S = eval(input()) -    if S[0] in A: -        s.append(S) -# print(s) -for i in s: -    for j in range(5): -        if A[j] == i[0]: -            B[j] += 1 -            break -c = B.count(0) -if c > 2: -    print((0)) -else: -    c = 0 -    for i in range(3): -        for j in range(i + 1, 4): -            for k in range(j + 1, 5): -                c += B[i] * B[j] * B[k] -    print(c) -# print(B) +    _s = eval(input()) +    if _s[0] in ["M", "A", "R", "C", "H"]: +        s[_s[0]] += 1 +s = list(s.items()) +ans = 0 +for i in range(5): +    for j in range(i + 1, 5): +        for k in range(j + 1, 5): +            ans += s[i][1] * s[j][1] * s[k][1] +print(ans)