n = int(eval(input()))

S = ''



for i in range(n):

    S += input()[0]

    

m = S.count('M')

a = S.count('A')

r = S.count('R')

c = S.count('C')

h = S.count('H')



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 collections import Counter

n = int(eval(input()))

A = [input()[0] for i in range(n)]



A = Counter(A)

m = A['M']

a = A['A']

r = A['R']

c = A['C']

h = A['H']



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))
n = int(eval(input()))
S = ""
for i in range(n):
    S += input()[0]
m = S.count("M")
a = S.count("A")
r = S.count("R")
c = S.count("C")
h = S.count("H")
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 collections import Counter

n = int(eval(input()))
A = [input()[0] for i in range(n)]
A = Counter(A)
m = A["M"]
a = A["A"]
r = A["R"]
c = A["C"]
h = A["H"]
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 collections import Counter + -S = "" -for i in range(n): -    S += input()[0] -m = S.count("M") -a = S.count("A") -r = S.count("R") -c = S.count("C") -h = S.count("H") +A = [input()[0] for i in range(n)] +A = Counter(A) +m = A["M"] +a = A["A"] +r = A["R"] +c = A["C"] +h = A["H"]