from itertools import combinations

from collections import defaultdict



n = int(eval(input()))

d = defaultdict(int)



for _ in range(n):

    tmp = eval(input())

    if tmp[0] in ["M", "A", "R", "C", "H"]:

        d[tmp[0]] += 1



li = list(combinations(list(d.keys()), 3))



ans = 0

for a, b, c in li:

    ans += d[a] * d[b] * d[c]



print(ans)
from itertools import combinations

n = int(eval(input()))

arr = [eval(input()) for _ in range(n)]



li = ["M", "A", "R", "C", "H"]



result = []

for s in li:

    result.append(len(set([x for x in arr if x[0] == s])))



ans = 0



for x, y, z in combinations(result, 3):

    ans += x * y * z



print(ans)
from itertools import combinations
from collections import defaultdict

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

from itertools import combinations

n = int(eval(input()))
arr = [eval(input()) for _ in range(n)]
li = ["M", "A", "R", "C", "H"]
result = []
for s in li:
    result.append(len(set([x for x in arr if x[0] == s])))
ans = 0
for x, y, z in combinations(result, 3):
    ans += x * y * z
print(ans)

-from collections import defaultdict -d = defaultdict(int) -for _ in range(n): -    tmp = eval(input()) -    if tmp[0] in ["M", "A", "R", "C", "H"]: -        d[tmp[0]] += 1 -li = list(combinations(list(d.keys()), 3)) +arr = [eval(input()) for _ in range(n)] +li = ["M", "A", "R", "C", "H"] +result = [] +for s in li: +    result.append(len(set([x for x in arr if x[0] == s]))) -for a, b, c in li: -    ans += d[a] * d[b] * d[c] +for x, y, z in combinations(result, 3): +    ans += x * y * z