from itertools import combinations

from functools import reduce



n = int(eval(input()))

x = [0 for _ in range(5)]

for _ in range(n):

    s = eval(input())

    if s[0] == "M":

        x[0] += 1

    if s[0] == "A":

        x[1] += 1

    if s[0] == "R":

        x[2] += 1

    if s[0] == "C":

        x[3] += 1

    if s[0] == "H":

        x[4] += 1



def f(a, b): return a*b



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

ans = 0

for c in combinations(x, 3):

    ans += reduce(f, c)



print(ans)
from collections import Counter

import itertools



n = int(eval(input()))

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



cnt = Counter(s)

ans = 0

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

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

print(ans)
from itertools import combinations
from functools import reduce

n = int(eval(input()))
x = [0 for _ in range(5)]
for _ in range(n):
    s = eval(input())
    if s[0] == "M":
        x[0] += 1
    if s[0] == "A":
        x[1] += 1
    if s[0] == "R":
        x[2] += 1
    if s[0] == "C":
        x[3] += 1
    if s[0] == "H":
        x[4] += 1


def f(a, b):
    return a * b


x = [n for n in x if n != 0]
ans = 0
for c in combinations(x, 3):
    ans += reduce(f, c)
print(ans)

from collections import Counter
import itertools

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

-from itertools import combinations -from functools import reduce +from collections import Counter +import itertools -x = [0 for _ in range(5)] -for _ in range(n): -    s = eval(input()) -    if s[0] == "M": -        x[0] += 1 -    if s[0] == "A": -        x[1] += 1 -    if s[0] == "R": -        x[2] += 1 -    if s[0] == "C": -        x[3] += 1 -    if s[0] == "H": -        x[4] += 1 - - -def f(a, b): -    return a * b - - -x = [n for n in x if n != 0] +s = [input()[0] for _ in range(n)] +cnt = Counter(s) -for c in combinations(x, 3): -    ans += reduce(f, c) +for x, y, z in itertools.combinations("MARCH", 3): +    ans += cnt[x] * cnt[y] * cnt[z]