# 2019/07/06



import sys



input=sys.stdin.readline



n=int(eval(input()))

s={}

for i in range(n):

    tmp=eval(input())

    if tmp[0] in ['M','A','R','C','H']:

        s[tmp[0]]=s.get(tmp[0],0)+1



# ↑ここまでできた

# ↓ここからわからん



ans=0

for ik,iv in list(s.items()):

    for jk,jv in list(s.items()):

        if ik==jk:break

        for kk,kv in list(s.items()):

            if jk==kk:break

            ans+=iv*jv*kv



print(ans)
import sys

from itertools import combinations

input=sys.stdin.readline



n=int(eval(input()))

s={}

for i in range(n):

    tmp=input()[0]

    if tmp in ['M','A','R','C','H']:

        s[tmp]=s.get(tmp,0)+1



ans=0



cmb=list(combinations(list(s.values()),3))



for a,b,c in cmb:

    ans+=a*b*c



print(ans)
# 2019/07/06
import sys

input = sys.stdin.readline
n = int(eval(input()))
s = {}
for i in range(n):
    tmp = eval(input())
    if tmp[0] in ["M", "A", "R", "C", "H"]:
        s[tmp[0]] = s.get(tmp[0], 0) + 1
# ↑ここまでできた
# ↓ここからわからん
ans = 0
for ik, iv in list(s.items()):
    for jk, jv in list(s.items()):
        if ik == jk:
            break
        for kk, kv in list(s.items()):
            if jk == kk:
                break
            ans += iv * jv * kv
print(ans)

import sys
from itertools import combinations

input = sys.stdin.readline
n = int(eval(input()))
s = {}
for i in range(n):
    tmp = input()[0]
    if tmp in ["M", "A", "R", "C", "H"]:
        s[tmp] = s.get(tmp, 0) + 1
ans = 0
cmb = list(combinations(list(s.values()), 3))
for a, b, c in cmb:
    ans += a * b * c
print(ans)

-# 2019/07/06 +from itertools import combinations -    tmp = eval(input()) -    if tmp[0] in ["M", "A", "R", "C", "H"]: -        s[tmp[0]] = s.get(tmp[0], 0) + 1 -# ↑ここまでできた -# ↓ここからわからん +    tmp = input()[0] +    if tmp in ["M", "A", "R", "C", "H"]: +        s[tmp] = s.get(tmp, 0) + 1 -for ik, iv in list(s.items()): -    for jk, jv in list(s.items()): -        if ik == jk: -            break -        for kk, kv in list(s.items()): -            if jk == kk: -                break -            ans += iv * jv * kv +cmb = list(combinations(list(s.values()), 3)) +for a, b, c in cmb: +    ans += a * b * c