import itertools



n = int(eval(input()))



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



for _ in range(n):

    s = eval(input())

    if s[0] in d:

        d[s[0]] += 1



l = list(d.keys())

comb = list(itertools.combinations(l, 3))



ans = 0

for i in comb:

    temp = 1

    for j in i:

        temp *= d[j]



    ans += temp



print(ans)
from itertools import combinations



n = int(eval(input()))

d = [0] * 5



for _ in range(n):

    s = eval(input())

    if s[0] == "M":

        d[0] += 1

    if s[0] == "A":

        d[1] += 1

    if s[0] == "R":

        d[2] += 1

    if s[0] == "C":

        d[3] += 1

    if s[0] == "H":

        d[4] += 1



d = [n for n in d if n !=0]



comb = combinations(d, 3)

ans = 0

for c in comb:

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



print(ans)
import itertools

n = int(eval(input()))
d = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for _ in range(n):
    s = eval(input())
    if s[0] in d:
        d[s[0]] += 1
l = list(d.keys())
comb = list(itertools.combinations(l, 3))
ans = 0
for i in comb:
    temp = 1
    for j in i:
        temp *= d[j]
    ans += temp
print(ans)

from itertools import combinations

n = int(eval(input()))
d = [0] * 5
for _ in range(n):
    s = eval(input())
    if s[0] == "M":
        d[0] += 1
    if s[0] == "A":
        d[1] += 1
    if s[0] == "R":
        d[2] += 1
    if s[0] == "C":
        d[3] += 1
    if s[0] == "H":
        d[4] += 1
d = [n for n in d if n != 0]
comb = combinations(d, 3)
ans = 0
for c in comb:
    ans += c[0] * c[1] * c[2]
print(ans)

-import itertools +from itertools import combinations -d = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} +d = [0] * 5 -    if s[0] in d: -        d[s[0]] += 1 -l = list(d.keys()) -comb = list(itertools.combinations(l, 3)) +    if s[0] == "M": +        d[0] += 1 +    if s[0] == "A": +        d[1] += 1 +    if s[0] == "R": +        d[2] += 1 +    if s[0] == "C": +        d[3] += 1 +    if s[0] == "H": +        d[4] += 1 +d = [n for n in d if n != 0] +comb = combinations(d, 3) -for i in comb: -    temp = 1 -    for j in i: -        temp *= d[j] -    ans += temp +for c in comb: +    ans += c[0] * c[1] * c[2]