import itertools



def solve(n, S):

    initials = ('M', 'A', 'R', 'C', 'H')

    d = {}

    for s in S:

        if s[0] in initials:

            d[s[0]] = d.get(s[0], 0) + 1

    return sum(d[x] * d[y] * d[z] for x, y, z in itertools.combinations(list(d.keys()), 3))



_n = int(eval(input()))

_S = [eval(input()) for _ in range(_n)]

print((solve(_n, _S)))
from itertools import combinations



n = int(eval(input()))

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

initials = ('M', 'A', 'R', 'C', 'H')

d = {}

for s in S:

  if s[0] in initials:

    d[s[0]] = d.get(s[0], 0) + 1



print((sum(d[x] * d[y] * d[z] for x, y, z in combinations(list(d.keys()), 3))))
import itertools


def solve(n, S):
    initials = ("M", "A", "R", "C", "H")
    d = {}
    for s in S:
        if s[0] in initials:
            d[s[0]] = d.get(s[0], 0) + 1
    return sum(
        d[x] * d[y] * d[z] for x, y, z in itertools.combinations(list(d.keys()), 3)
    )


_n = int(eval(input()))
_S = [eval(input()) for _ in range(_n)]
print((solve(_n, _S)))

from itertools import combinations

n = int(eval(input()))
S = [eval(input()) for _ in range(n)]
initials = ("M", "A", "R", "C", "H")
d = {}
for s in S:
    if s[0] in initials:
        d[s[0]] = d.get(s[0], 0) + 1
print((sum(d[x] * d[y] * d[z] for x, y, z in combinations(list(d.keys()), 3))))

-import itertools +from itertools import combinations - -def solve(n, S): -    initials = ("M", "A", "R", "C", "H") -    d = {} -    for s in S: -        if s[0] in initials: -            d[s[0]] = d.get(s[0], 0) + 1 -    return sum( -        d[x] * d[y] * d[z] for x, y, z in itertools.combinations(list(d.keys()), 3) -    ) - - -_n = int(eval(input())) -_S = [eval(input()) for _ in range(_n)] -print((solve(_n, _S))) +n = int(eval(input())) +S = [eval(input()) for _ in range(n)] +initials = ("M", "A", "R", "C", "H") +d = {} +for s in S: +    if s[0] in initials: +        d[s[0]] = d.get(s[0], 0) + 1 +print((sum(d[x] * d[y] * d[z] for x, y, z in combinations(list(d.keys()), 3))))