from collections import defaultdict

from itertools import combinations



n = int(eval(input()))

d = defaultdict(int)

for _ in range(n):

    s = eval(input())

    d[s[0]] += 1



con = []

for c in ('M', 'A', 'R', 'C', 'H'):

    k = d[c]

    if k:

        con.append(k)



ans = 0

for a, b, c in combinations(con, 3):

    ans += a * b * c



print(ans)

from collections import Counter

from itertools import combinations



n = int(eval(input()))

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

con = [l[c] for c in 'MARCH' if c in l]

print((sum(a * b * c for a, b, c in combinations(con, 3))))

from collections import defaultdict
from itertools import combinations

n = int(eval(input()))
d = defaultdict(int)
for _ in range(n):
    s = eval(input())
    d[s[0]] += 1
con = []
for c in ("M", "A", "R", "C", "H"):
    k = d[c]
    if k:
        con.append(k)
ans = 0
for a, b, c in combinations(con, 3):
    ans += a * b * c
print(ans)

from collections import Counter
from itertools import combinations

n = int(eval(input()))
l = Counter(input()[0] for _ in range(n))
con = [l[c] for c in "MARCH" if c in l]
print((sum(a * b * c for a, b, c in combinations(con, 3))))

-from collections import defaultdict +from collections import Counter -d = defaultdict(int) -for _ in range(n): -    s = eval(input()) -    d[s[0]] += 1 -con = [] -for c in ("M", "A", "R", "C", "H"): -    k = d[c] -    if k: -        con.append(k) -ans = 0 -for a, b, c in combinations(con, 3): -    ans += a * b * c -print(ans) +l = Counter(input()[0] for _ in range(n)) +con = [l[c] for c in "MARCH" if c in l] +print((sum(a * b * c for a, b, c in combinations(con, 3))))