N = int(eval(input()))

S = [list(eval(input())) for i in range(N)]

M = []

A = []

R = []

C = []

H = []

for j in range(N):

  if (S[j][0] == 'M'):

    M.append(S[j])

  elif (S[j][0] == 'A'):

    A.append(S[j])

  elif (S[j][0] == 'R'):

    R.append(S[j])

  elif (S[j][0] == 'C'):

    C.append(S[j])

  elif (S[j][0] == 'H'):

    H.append(S[j])

  else:

    None

print((len(M)*len(A)*len(R)+len(M)*len(A)*len(C)+len(M)*len(A)*len(H)+len(M)*len(R)*len(C)+len(M)*len(R)*len(H)+len(M)*len(C)*len(H)+len(A)*len(R)*len(C)+len(A)*len(R)*len(H)+len(R)*len(C)*len(H)+len(A)*len(C)*len(H)))

import itertools

N = int(eval(input()))

L = [0]*5

for i in range(N):

  S = eval(input())

  if S[0] == 'M':

    L[0] += 1

  elif S[0] == 'A':

    L[1] += 1

  elif S[0] == 'R':

    L[2] += 1

  elif S[0] == 'C':

    L[3] += 1

  elif S[0] == 'H':

    L[4] += 1

K = list(itertools.combinations(L,3))

ans = 0

for i in range(len(K)):

  ans += K[i][0]*K[i][1]*K[i][2]

print(ans)
N = int(eval(input()))
S = [list(eval(input())) for i in range(N)]
M = []
A = []
R = []
C = []
H = []
for j in range(N):
    if S[j][0] == "M":
        M.append(S[j])
    elif S[j][0] == "A":
        A.append(S[j])
    elif S[j][0] == "R":
        R.append(S[j])
    elif S[j][0] == "C":
        C.append(S[j])
    elif S[j][0] == "H":
        H.append(S[j])
    else:
        None
print(
    (
        len(M) * len(A) * len(R)
        + len(M) * len(A) * len(C)
        + len(M) * len(A) * len(H)
        + len(M) * len(R) * len(C)
        + len(M) * len(R) * len(H)
        + len(M) * len(C) * len(H)
        + len(A) * len(R) * len(C)
        + len(A) * len(R) * len(H)
        + len(R) * len(C) * len(H)
        + len(A) * len(C) * len(H)
    )
)

import itertools

N = int(eval(input()))
L = [0] * 5
for i in range(N):
    S = eval(input())
    if S[0] == "M":
        L[0] += 1
    elif S[0] == "A":
        L[1] += 1
    elif S[0] == "R":
        L[2] += 1
    elif S[0] == "C":
        L[3] += 1
    elif S[0] == "H":
        L[4] += 1
K = list(itertools.combinations(L, 3))
ans = 0
for i in range(len(K)):
    ans += K[i][0] * K[i][1] * K[i][2]
print(ans)

+import itertools + -S = [list(eval(input())) for i in range(N)] -M = [] -A = [] -R = [] -C = [] -H = [] -for j in range(N): -    if S[j][0] == "M": -        M.append(S[j]) -    elif S[j][0] == "A": -        A.append(S[j]) -    elif S[j][0] == "R": -        R.append(S[j]) -    elif S[j][0] == "C": -        C.append(S[j]) -    elif S[j][0] == "H": -        H.append(S[j]) -    else: -        None -print( -    ( -        len(M) * len(A) * len(R) -        + len(M) * len(A) * len(C) -        + len(M) * len(A) * len(H) -        + len(M) * len(R) * len(C) -        + len(M) * len(R) * len(H) -        + len(M) * len(C) * len(H) -        + len(A) * len(R) * len(C) -        + len(A) * len(R) * len(H) -        + len(R) * len(C) * len(H) -        + len(A) * len(C) * len(H) -    ) -) +L = [0] * 5 +for i in range(N): +    S = eval(input()) +    if S[0] == "M": +        L[0] += 1 +    elif S[0] == "A": +        L[1] += 1 +    elif S[0] == "R": +        L[2] += 1 +    elif S[0] == "C": +        L[3] += 1 +    elif S[0] == "H": +        L[4] += 1 +K = list(itertools.combinations(L, 3)) +ans = 0 +for i in range(len(K)): +    ans += K[i][0] * K[i][1] * K[i][2] +print(ans)