from itertools import combinations

N=int(eval(input()))

d={}

for _ in range(N):

  s=eval(input())

  if not s[0] in ["M","A","R","C","H"]:continue 

  if not s[0] in d:

    d[s[0]]=1

  else:

    d[s[0]]+=1

res=0

for i in combinations(list(d.keys()),3):

  res+=d[i[0]]*d[i[1]]*d[i[2]]

print(res)
from collections import Counter

from itertools import combinations as comb



N = int(eval(input()))

d = Counter()

for _ in range(N):

    s = eval(input())

    d[s[0]] += 1



ans = 0

for i, j, k in comb(["M","A","R","C","H"], 3):

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

print(ans)

from itertools import combinations

N = int(eval(input()))
d = {}
for _ in range(N):
    s = eval(input())
    if not s[0] in ["M", "A", "R", "C", "H"]:
        continue
    if not s[0] in d:
        d[s[0]] = 1
    else:
        d[s[0]] += 1
res = 0
for i in combinations(list(d.keys()), 3):
    res += d[i[0]] * d[i[1]] * d[i[2]]
print(res)

from collections import Counter
from itertools import combinations as comb

N = int(eval(input()))
d = Counter()
for _ in range(N):
    s = eval(input())
    d[s[0]] += 1
ans = 0
for i, j, k in comb(["M", "A", "R", "C", "H"], 3):
    ans += d[i] * d[j] * d[k]
print(ans)

-from itertools import combinations +from collections import Counter +from itertools import combinations as comb -d = {} +d = Counter() -    if not s[0] in ["M", "A", "R", "C", "H"]: -        continue -    if not s[0] in d: -        d[s[0]] = 1 -    else: -        d[s[0]] += 1 -res = 0 -for i in combinations(list(d.keys()), 3): -    res += d[i[0]] * d[i[1]] * d[i[2]] -print(res) +    d[s[0]] += 1 +ans = 0 +for i, j, k in comb(["M", "A", "R", "C", "H"], 3): +    ans += d[i] * d[j] * d[k] +print(ans)