N = int(eval(input()))

S = []

for i in range(N):

    S.append(eval(input()))



isMARCH = [0]*5

for name in S:

    if name[0] == "M":

        isMARCH[0] += 1

    elif name[0] == "A":

        isMARCH[1] += 1

    elif name[0] == "R":

        isMARCH[2] += 1

    elif name[0] == "C":

        isMARCH[3] += 1

    elif name[0] == "H":

        isMARCH[4] += 1

        

ans = 0

for i in range(3):

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

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

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

            

print(ans)
from itertools import combinations



import sys

sdin = sys.stdin.readline



n = int(sdin())

s = [sdin() for _ in range(n)]



# marchで始まっている人をカウント

m = len([si for si in s if si.startswith("M")])

a = len([si for si in s if si.startswith("A")])

r = len([si for si in s if si.startswith("R")])

c = len([si for si in s if si.startswith("C")])

h = len([si for si in s if si.startswith("H")])



cmb = []

for char in [m,a,r,c,h]:

    if char > 0:

        cmb.append(char)



res = 0

cands = list(combinations(cmb,3))

for x,y,z in cands:

    res += x*y*z

    

print(res)

    
N = int(eval(input()))
S = []
for i in range(N):
    S.append(eval(input()))
isMARCH = [0] * 5
for name in S:
    if name[0] == "M":
        isMARCH[0] += 1
    elif name[0] == "A":
        isMARCH[1] += 1
    elif name[0] == "R":
        isMARCH[2] += 1
    elif name[0] == "C":
        isMARCH[3] += 1
    elif name[0] == "H":
        isMARCH[4] += 1
ans = 0
for i in range(3):
    for j in range(i + 1, 4):
        for k in range(j + 1, 5):
            ans += isMARCH[i] * isMARCH[j] * isMARCH[k]
print(ans)

from itertools import combinations
import sys

sdin = sys.stdin.readline
n = int(sdin())
s = [sdin() for _ in range(n)]
# marchで始まっている人をカウント
m = len([si for si in s if si.startswith("M")])
a = len([si for si in s if si.startswith("A")])
r = len([si for si in s if si.startswith("R")])
c = len([si for si in s if si.startswith("C")])
h = len([si for si in s if si.startswith("H")])
cmb = []
for char in [m, a, r, c, h]:
    if char > 0:
        cmb.append(char)
res = 0
cands = list(combinations(cmb, 3))
for x, y, z in cands:
    res += x * y * z
print(res)

-N = int(eval(input())) -S = [] -for i in range(N): -    S.append(eval(input())) -isMARCH = [0] * 5 -for name in S: -    if name[0] == "M": -        isMARCH[0] += 1 -    elif name[0] == "A": -        isMARCH[1] += 1 -    elif name[0] == "R": -        isMARCH[2] += 1 -    elif name[0] == "C": -        isMARCH[3] += 1 -    elif name[0] == "H": -        isMARCH[4] += 1 -ans = 0 -for i in range(3): -    for j in range(i + 1, 4): -        for k in range(j + 1, 5): -            ans += isMARCH[i] * isMARCH[j] * isMARCH[k] -print(ans) +from itertools import combinations +import sys + +sdin = sys.stdin.readline +n = int(sdin()) +s = [sdin() for _ in range(n)] +# marchで始まっている人をカウント +m = len([si for si in s if si.startswith("M")]) +a = len([si for si in s if si.startswith("A")]) +r = len([si for si in s if si.startswith("R")]) +c = len([si for si in s if si.startswith("C")]) +h = len([si for si in s if si.startswith("H")]) +cmb = [] +for char in [m, a, r, c, h]: +    if char > 0: +        cmb.append(char) +res = 0 +cands = list(combinations(cmb, 3)) +for x, y, z in cands: +    res += x * y * z +print(res)