import itertools

s = set()

N = int(eval(input()))

dict = {i:0 for i in "MARCH"}



sum_v = 0

ans = 0

for i in range(N):

    S = eval(input())

    if(S[0] in "MARCH"):

        dict[S[0]] += 1

        s.add(S[0])

        sum_v += 1

        

c = itertools.combinations(s, 3)



for i in c:

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

    

print(ans)
import itertools 

N = int(eval(input()))

march = list(itertools.combinations("MARCH", 3))

dict = {i:0 for i in "MARCH"}

for _ in range(N):

    S = eval(input())

    if(S[0] in "MARCH"):

        dict[S[0]] += 1

ans = 0

for i in range(10):

    ans +=  dict[march[i][0]]*dict[march[i][1]]*dict[march[i][2]]



print(ans)
import itertools

s = set()
N = int(eval(input()))
dict = {i: 0 for i in "MARCH"}
sum_v = 0
ans = 0
for i in range(N):
    S = eval(input())
    if S[0] in "MARCH":
        dict[S[0]] += 1
        s.add(S[0])
        sum_v += 1
c = itertools.combinations(s, 3)
for i in c:
    ans += dict[i[0]] * dict[i[1]] * dict[i[2]]
print(ans)

import itertools

N = int(eval(input()))
march = list(itertools.combinations("MARCH", 3))
dict = {i: 0 for i in "MARCH"}
for _ in range(N):
    S = eval(input())
    if S[0] in "MARCH":
        dict[S[0]] += 1
ans = 0
for i in range(10):
    ans += dict[march[i][0]] * dict[march[i][1]] * dict[march[i][2]]
print(ans)

-s = set() +march = list(itertools.combinations("MARCH", 3)) -sum_v = 0 -ans = 0 -for i in range(N): +for _ in range(N): -        s.add(S[0]) -        sum_v += 1 -c = itertools.combinations(s, 3) -for i in c: -    ans += dict[i[0]] * dict[i[1]] * dict[i[2]] +ans = 0 +for i in range(10): +    ans += dict[march[i][0]] * dict[march[i][1]] * dict[march[i][2]]