N = int(eval(input()))

count = [0]*5

march = list("MARCH")

for i in range(N):

    s = eval(input())

    for i in range(5):

        if s[0] == march[i]:

            count[i] += 1

ans = 0

for i in range(5):

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

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

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

print(ans)
from itertools import combinations



N = int(eval(input()))

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



chenge = list("MARCH")

d = dict()

for i, c in enumerate(chenge):

    d[c] = i



cnt = [0] * 5



for s in S:

    if s[0] in chenge:

        cnt[d[s[0]]] += 1



ans = 0



for i, j, k in combinations(cnt, 3):

    ans += i * j * k



print(ans)
N = int(eval(input()))
count = [0] * 5
march = list("MARCH")
for i in range(N):
    s = eval(input())
    for i in range(5):
        if s[0] == march[i]:
            count[i] += 1
ans = 0
for i in range(5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            ans += count[i] * count[j] * count[k]
print(ans)

from itertools import combinations

N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
chenge = list("MARCH")
d = dict()
for i, c in enumerate(chenge):
    d[c] = i
cnt = [0] * 5
for s in S:
    if s[0] in chenge:
        cnt[d[s[0]]] += 1
ans = 0
for i, j, k in combinations(cnt, 3):
    ans += i * j * k
print(ans)

+from itertools import combinations + -count = [0] * 5 -march = list("MARCH") -for i in range(N): -    s = eval(input()) -    for i in range(5): -        if s[0] == march[i]: -            count[i] += 1 +S = [eval(input()) for _ in range(N)] +chenge = list("MARCH") +d = dict() +for i, c in enumerate(chenge): +    d[c] = i +cnt = [0] * 5 +for s in S: +    if s[0] in chenge: +        cnt[d[s[0]]] += 1 -for i in range(5): -    for j in range(i + 1, 5): -        for k in range(j + 1, 5): -            ans += count[i] * count[j] * count[k] +for i, j, k in combinations(cnt, 3): +    ans += i * j * k