n = int(eval(input()))



s = [eval(input()) for i in range(n)]



order = "MARCH"



nums = [[name[0] for name in s].count(order[i]) for i in range(len(order))]



ans = 0

for i in range(0, 5):

    for j in range(i+1, 5):

        for k in range(j+1, 5):

            ans += nums[i] * nums[j] * nums[k]

            

print(ans)



n = int(eval(input()))



s = [eval(input()) for i in range(n)]



order = "MARCH"



initial_array = [name[0] for name in s]

nums = [initial_array.count(order[i]) for i in range(len(order))]



ans = 0

for i in range(0, 5):

    for j in range(i+1, 5):

        for k in range(j+1, 5):

            ans += nums[i] * nums[j] * nums[k]

            

print(ans)



n = int(eval(input()))
s = [eval(input()) for i in range(n)]
order = "MARCH"
nums = [[name[0] for name in s].count(order[i]) for i in range(len(order))]
ans = 0
for i in range(0, 5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            ans += nums[i] * nums[j] * nums[k]
print(ans)

n = int(eval(input()))
s = [eval(input()) for i in range(n)]
order = "MARCH"
initial_array = [name[0] for name in s]
nums = [initial_array.count(order[i]) for i in range(len(order))]
ans = 0
for i in range(0, 5):
    for j in range(i + 1, 5):
        for k in range(j + 1, 5):
            ans += nums[i] * nums[j] * nums[k]
print(ans)

-nums = [[name[0] for name in s].count(order[i]) for i in range(len(order))] +initial_array = [name[0] for name in s] +nums = [initial_array.count(order[i]) for i in range(len(order))]