import fractions

import itertools

N = int(eval(input()))

M =[]

A = []

R = []

C = []

H = []





for i in range(N):

    name = eval(input())

    initial = name[0]

    if initial == "M":

        M.append(name)

    elif initial == "A":

        A.append(name)

    elif initial == "R":

        R.append(name)

    elif initial == "C":

        C.append(name)

    elif initial == "H":

        H.append(name)



count = 0

S = []

if len(M) > 0:

    S.append(len(M))

if len(A) > 0:

    S.append(len(A))

if len(R) > 0:

    S.append(len(R))

if len(C) > 0:

    S.append(len(C))

if len(H) > 0:

    S.append(len(H))



if len(S) < 3:

    print("0")

    exit(0)



a = itertools.combinations(S,3)

ans = 0

for x in list(a):

    tmp = 1

    for y in x:

        tmp *= y

    ans += tmp

print(ans)









from itertools import combinations

import collections

N = int(eval(input()))

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

table = collections.defaultdict(int)



for x in S:

    table[x[0]] += 1



tmp = ["M", "A", "R", "C", "H"]





ans = 0

for x in combinations(tmp, 3):

    ans += table[x[0]]*table[x[1]]*table[x[2]]

print(ans)

import fractions
import itertools

N = int(eval(input()))
M = []
A = []
R = []
C = []
H = []
for i in range(N):
    name = eval(input())
    initial = name[0]
    if initial == "M":
        M.append(name)
    elif initial == "A":
        A.append(name)
    elif initial == "R":
        R.append(name)
    elif initial == "C":
        C.append(name)
    elif initial == "H":
        H.append(name)
count = 0
S = []
if len(M) > 0:
    S.append(len(M))
if len(A) > 0:
    S.append(len(A))
if len(R) > 0:
    S.append(len(R))
if len(C) > 0:
    S.append(len(C))
if len(H) > 0:
    S.append(len(H))
if len(S) < 3:
    print("0")
    exit(0)
a = itertools.combinations(S, 3)
ans = 0
for x in list(a):
    tmp = 1
    for y in x:
        tmp *= y
    ans += tmp
print(ans)

from itertools import combinations
import collections

N = int(eval(input()))
S = [eval(input()) for i in range(N)]
table = collections.defaultdict(int)
for x in S:
    table[x[0]] += 1
tmp = ["M", "A", "R", "C", "H"]
ans = 0
for x in combinations(tmp, 3):
    ans += table[x[0]] * table[x[1]] * table[x[2]]
print(ans)

-import fractions -import itertools +from itertools import combinations +import collections -M = [] -A = [] -R = [] -C = [] -H = [] -for i in range(N): -    name = eval(input()) -    initial = name[0] -    if initial == "M": -        M.append(name) -    elif initial == "A": -        A.append(name) -    elif initial == "R": -        R.append(name) -    elif initial == "C": -        C.append(name) -    elif initial == "H": -        H.append(name) -count = 0 -S = [] -if len(M) > 0: -    S.append(len(M)) -if len(A) > 0: -    S.append(len(A)) -if len(R) > 0: -    S.append(len(R)) -if len(C) > 0: -    S.append(len(C)) -if len(H) > 0: -    S.append(len(H)) -if len(S) < 3: -    print("0") -    exit(0) -a = itertools.combinations(S, 3) +S = [eval(input()) for i in range(N)] +table = collections.defaultdict(int) +for x in S: +    table[x[0]] += 1 +tmp = ["M", "A", "R", "C", "H"] -for x in list(a): -    tmp = 1 -    for y in x: -        tmp *= y -    ans += tmp +for x in combinations(tmp, 3): +    ans += table[x[0]] * table[x[1]] * table[x[2]]