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)
from itertools import combinations

from collections import Counter



n = int(eval(input()))

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



c  =Counter(s)

ans = 0

for x, y, z in combinations("MARCH", 3):

    ans += c[x] * c[y] * c[z]



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)

from itertools import combinations
from collections import Counter

n = int(eval(input()))
s = [input()[0] for _ in range(n)]
c = Counter(s)
ans = 0
for x, y, z in combinations("MARCH", 3):
    ans += c[x] * c[y] * c[z]
print(ans)

+from collections import Counter -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) +s = [input()[0] for _ in range(n)] +c = Counter(s) -for c in comb: -    ans += c[0] * c[1] * c[2] +for x, y, z in combinations("MARCH", 3): +    ans += c[x] * c[y] * c[z]