n = int(eval(input()))

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

for i in range(n):

    s = eval(input())

    if s[0]=='M':

        m += 1

    elif s[0]=='A':

        a += 1

    elif s[0]=='R':

        r += 1

    elif s[0]=='C':

        c += 1

    elif s[0]=='H':

        h += 1

print((m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+ a*r*c+a*r*h+a*c*h+r*c*h))

from itertools import combinations

n, *S = open(0).read().split()

# 頭文字だけ抜き出す.

cap = [s[0] for s in S]

# M,A,R,C,H,それぞれ頭文字の中にある数をカウント.

cnt = [cap.count(i) for i in "MARCH"]

# 組み合わせの合計を取る.

ans = sum(x*y*z for x, y, z in combinations(cnt, 3))

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

from itertools import combinations

n, *S = open(0).read().split()
# 頭文字だけ抜き出す.
cap = [s[0] for s in S]
# M,A,R,C,H,それぞれ頭文字の中にある数をカウント.
cnt = [cap.count(i) for i in "MARCH"]
# 組み合わせの合計を取る.
ans = sum(x * y * z for x, y, z in combinations(cnt, 3))
print(ans)

-n = int(eval(input())) -m, a, r, c, h = 0, 0, 0, 0, 0 -for i in range(n): -    s = eval(input()) -    if s[0] == "M": -        m += 1 -    elif s[0] == "A": -        a += 1 -    elif s[0] == "R": -        r += 1 -    elif s[0] == "C": -        c += 1 -    elif s[0] == "H": -        h += 1 -print( -    ( -        m * a * r -        + m * a * c -        + m * a * h -        + m * r * c -        + m * r * h -        + m * c * h -        + a * r * c -        + a * r * h -        + a * c * h -        + r * c * h -    ) -) +from itertools import combinations + +n, *S = open(0).read().split() +# 頭文字だけ抜き出す. +cap = [s[0] for s in S] +# M,A,R,C,H,それぞれ頭文字の中にある数をカウント. +cnt = [cap.count(i) for i in "MARCH"] +# 組み合わせの合計を取る. +ans = sum(x * y * z for x, y, z in combinations(cnt, 3)) +print(ans)