N = int(eval(input()))

Sset = set()

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

for _ in range(N):

    S = eval(input())

    if S in Sset:

        continue

    if S[0] in {"M", "A", "R", "C", "H"}:

        Sset.add(S)

        str_dict[S[0]] += 1



non0 = []

for item in list(str_dict.items()):

    if item[1] > 0:

        non0.append(item[0])



num = 0

from itertools import combinations

for comb in combinations(non0, 3):

    num += str_dict[comb[0]] * str_dict[comb[1]] * str_dict[comb[2]]



print(num)

from collections import Counter

from itertools import combinations

N = int(eval(input()))

Slist = [eval(input()) for _ in range(N)]

Sc = Counter([S[0] for S in Slist])

ans = 0

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

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

print(ans)
N = int(eval(input()))
Sset = set()
str_dict = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for _ in range(N):
    S = eval(input())
    if S in Sset:
        continue
    if S[0] in {"M", "A", "R", "C", "H"}:
        Sset.add(S)
        str_dict[S[0]] += 1
non0 = []
for item in list(str_dict.items()):
    if item[1] > 0:
        non0.append(item[0])
num = 0
from itertools import combinations

for comb in combinations(non0, 3):
    num += str_dict[comb[0]] * str_dict[comb[1]] * str_dict[comb[2]]
print(num)

from collections import Counter
from itertools import combinations

N = int(eval(input()))
Slist = [eval(input()) for _ in range(N)]
Sc = Counter([S[0] for S in Slist])
ans = 0
for x, y, z in combinations(list("MARCH"), 3):
    ans += Sc[x] * Sc[y] * Sc[z]
print(ans)

-N = int(eval(input())) -Sset = set() -str_dict = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} -for _ in range(N): -    S = eval(input()) -    if S in Sset: -        continue -    if S[0] in {"M", "A", "R", "C", "H"}: -        Sset.add(S) -        str_dict[S[0]] += 1 -non0 = [] -for item in list(str_dict.items()): -    if item[1] > 0: -        non0.append(item[0]) -num = 0 +from collections import Counter -for comb in combinations(non0, 3): -    num += str_dict[comb[0]] * str_dict[comb[1]] * str_dict[comb[2]] -print(num) +N = int(eval(input())) +Slist = [eval(input()) for _ in range(N)] +Sc = Counter([S[0] for S in Slist]) +ans = 0 +for x, y, z in combinations(list("MARCH"), 3): +    ans += Sc[x] * Sc[y] * Sc[z] +print(ans)