n = int(eval(input()))



march = ("M","A","R","C","H")

prefix = []

d = {}

for _ in range(n):

  pre = input()[0]

  if pre in march:

    if pre not in prefix:

      prefix.append(pre)

      d[pre] = 1

    else:

      d[pre] += 1

      

t = len(prefix)

if t < 3:

  print((0))

  exit()



ans = 0

for i in range(t-2):

  for j in range(i+1, t-1):

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

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

print(ans)
from collections import Counter

from itertools import combinations

n = int(eval(input()))

s = []

for _ in range(n):

  t = input()[0]

  if t in {"M","A","R","C","H"}:

    s.append(t)



count = Counter(s)

if len(count) < 3:

  print((0))

  exit()



nums = []

for i in list(count.values()):nums.append(i)



ans = 0

for i in combinations(nums, 3):

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

print(ans)
n = int(eval(input()))
march = ("M", "A", "R", "C", "H")
prefix = []
d = {}
for _ in range(n):
    pre = input()[0]
    if pre in march:
        if pre not in prefix:
            prefix.append(pre)
            d[pre] = 1
        else:
            d[pre] += 1
t = len(prefix)
if t < 3:
    print((0))
    exit()
ans = 0
for i in range(t - 2):
    for j in range(i + 1, t - 1):
        for k in range(j + 1, t):
            ans += d[prefix[i]] * d[prefix[j]] * d[prefix[k]]
print(ans)

from collections import Counter
from itertools import combinations

n = int(eval(input()))
s = []
for _ in range(n):
    t = input()[0]
    if t in {"M", "A", "R", "C", "H"}:
        s.append(t)
count = Counter(s)
if len(count) < 3:
    print((0))
    exit()
nums = []
for i in list(count.values()):
    nums.append(i)
ans = 0
for i in combinations(nums, 3):
    ans += i[0] * i[1] * i[2]
print(ans)

+from collections import Counter +from itertools import combinations + -march = ("M", "A", "R", "C", "H") -prefix = [] -d = {} +s = [] -    pre = input()[0] -    if pre in march: -        if pre not in prefix: -            prefix.append(pre) -            d[pre] = 1 -        else: -            d[pre] += 1 -t = len(prefix) -if t < 3: +    t = input()[0] +    if t in {"M", "A", "R", "C", "H"}: +        s.append(t) +count = Counter(s) +if len(count) < 3: +nums = [] +for i in list(count.values()): +    nums.append(i) -for i in range(t - 2): -    for j in range(i + 1, t - 1): -        for k in range(j + 1, t): -            ans += d[prefix[i]] * d[prefix[j]] * d[prefix[k]] +for i in combinations(nums, 3): +    ans += i[0] * i[1] * i[2]