n = int(eval(input()))

m,a,r,c,h = 0,0,0,0,0

for i in range(n):

    s = input()[0]

    if s=='M':m+=1

    elif s=='A':a+=1

    elif s=='R':r+=1

    elif s=='C':c+=1

    elif s=='H':h+=1

x = [m,a,r,c,h]

ans = 0

for i in range(5):

    for j in range(i):

        for k in range(j):

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

print(ans)
import itertools

from collections import Counter



n=int(eval(input()))

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

d=Counter(s)

ans=0

for i,j,k in itertools.combinations("MARCH",3):

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

print(ans)
n = int(eval(input()))
m, a, r, c, h = 0, 0, 0, 0, 0
for i in range(n):
    s = input()[0]
    if s == "M":
        m += 1
    elif s == "A":
        a += 1
    elif s == "R":
        r += 1
    elif s == "C":
        c += 1
    elif s == "H":
        h += 1
x = [m, a, r, c, h]
ans = 0
for i in range(5):
    for j in range(i):
        for k in range(j):
            ans += x[i] * x[j] * x[k]
print(ans)

import itertools
from collections import Counter

n = int(eval(input()))
s = [input()[0] for _ in range(n)]
d = Counter(s)
ans = 0
for i, j, k in itertools.combinations("MARCH", 3):
    ans += d[i] * d[j] * d[k]
print(ans)

+import itertools +from collections import Counter + -m, a, r, c, h = 0, 0, 0, 0, 0 -for i in range(n): -    s = input()[0] -    if s == "M": -        m += 1 -    elif s == "A": -        a += 1 -    elif s == "R": -        r += 1 -    elif s == "C": -        c += 1 -    elif s == "H": -        h += 1 -x = [m, a, r, c, h] +s = [input()[0] for _ in range(n)] +d = Counter(s) -for i in range(5): -    for j in range(i): -        for k in range(j): -            ans += x[i] * x[j] * x[k] +for i, j, k in itertools.combinations("MARCH", 3): +    ans += d[i] * d[j] * d[k]