#!/usr/bin/env python3



n = int(eval(input()))

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



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

t = 'MARCH'



for i in range(n):

    for j in range(5):

        if s[i][0] == t[j]:

            c[j] += 1

ans = 0 

for i in range(5):

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

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

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

print(ans)

#!/usr/bin/env python3



n = int(eval(input()))

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

d = {}



for c in s:

    if c[0] not in d:

        d[c[0]] = 1 

    else:

        d[c[0]] += 1



tmp = d.copy()

t = ['M', 'A', 'R', 'C', 'H']

for c in tmp:

    if c not in t:

        d.pop(c)



ans = 0 

dlist = list(d.items())

for i in range(len(dlist)):

    for j in range(i+1, len(dlist)):

        for k in range(j+1, len(dlist)):

            ans += dlist[i][1]*dlist[j][1]*dlist[k][1]

print(ans)

#!/usr/bin/env python3
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
c = [0 for _ in range(5)]
t = "MARCH"
for i in range(n):
    for j in range(5):
        if s[i][0] == t[j]:
            c[j] += 1
ans = 0
for i in range(5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            ans += c[i] * c[k] * c[j]
print(ans)

#!/usr/bin/env python3
n = int(eval(input()))
s = [eval(input()) for _ in range(n)]
d = {}
for c in s:
    if c[0] not in d:
        d[c[0]] = 1
    else:
        d[c[0]] += 1
tmp = d.copy()
t = ["M", "A", "R", "C", "H"]
for c in tmp:
    if c not in t:
        d.pop(c)
ans = 0
dlist = list(d.items())
for i in range(len(dlist)):
    for j in range(i + 1, len(dlist)):
        for k in range(j + 1, len(dlist)):
            ans += dlist[i][1] * dlist[j][1] * dlist[k][1]
print(ans)

-c = [0 for _ in range(5)] -t = "MARCH" -for i in range(n): -    for j in range(5): -        if s[i][0] == t[j]: -            c[j] += 1 +d = {} +for c in s: +    if c[0] not in d: +        d[c[0]] = 1 +    else: +        d[c[0]] += 1 +tmp = d.copy() +t = ["M", "A", "R", "C", "H"] +for c in tmp: +    if c not in t: +        d.pop(c) -for i in range(5): -    for j in range(i + 1, 5): -        for k in range(j + 1, 5): -            ans += c[i] * c[k] * c[j] +dlist = list(d.items()) +for i in range(len(dlist)): +    for j in range(i + 1, len(dlist)): +        for k in range(j + 1, len(dlist)): +            ans += dlist[i][1] * dlist[j][1] * dlist[k][1]