from functools import reduce

from itertools import combinations

import copy



N = int(eval(input()))

S = {key: 0 for key in 'MARCH'}

for _ in range(N):

  s = eval(input())

  if s[0] in S:

    S[s[0]] += 1



newS = copy.deepcopy(S)

keys = []

for key, value in list(S.items()):

  if value == 0: del newS[key]

  else: keys.append(key)



if len(newS) < 3:

  print((0))

  exit()

  

ans = 0

for cmb in combinations(keys,3):

  ans += reduce(lambda x,y: x*y, [newS[idx] for idx in cmb])

print(ans)
import functools

import itertools

import operator



required_char = 'MARCH'

N = int(eval(input()))

name_counter = {s: 0 for s in required_char}

for _ in range(N):

    S = eval(input())

    if S[0] in required_char:

        name_counter[S[0]] += 1

ans = 0

for cmb in itertools.combinations(list(name_counter.values()), 3):

    ans += functools.reduce(operator.mul, cmb)

print(ans)

from functools import reduce
from itertools import combinations
import copy

N = int(eval(input()))
S = {key: 0 for key in "MARCH"}
for _ in range(N):
    s = eval(input())
    if s[0] in S:
        S[s[0]] += 1
newS = copy.deepcopy(S)
keys = []
for key, value in list(S.items()):
    if value == 0:
        del newS[key]
    else:
        keys.append(key)
if len(newS) < 3:
    print((0))
    exit()
ans = 0
for cmb in combinations(keys, 3):
    ans += reduce(lambda x, y: x * y, [newS[idx] for idx in cmb])
print(ans)

import functools
import itertools
import operator

required_char = "MARCH"
N = int(eval(input()))
name_counter = {s: 0 for s in required_char}
for _ in range(N):
    S = eval(input())
    if S[0] in required_char:
        name_counter[S[0]] += 1
ans = 0
for cmb in itertools.combinations(list(name_counter.values()), 3):
    ans += functools.reduce(operator.mul, cmb)
print(ans)

-from functools import reduce -from itertools import combinations -import copy +import functools +import itertools +import operator +required_char = "MARCH" -S = {key: 0 for key in "MARCH"} +name_counter = {s: 0 for s in required_char} -    s = eval(input()) -    if s[0] in S: -        S[s[0]] += 1 -newS = copy.deepcopy(S) -keys = [] -for key, value in list(S.items()): -    if value == 0: -        del newS[key] -    else: -        keys.append(key) -if len(newS) < 3: -    print((0)) -    exit() +    S = eval(input()) +    if S[0] in required_char: +        name_counter[S[0]] += 1 -for cmb in combinations(keys, 3): -    ans += reduce(lambda x, y: x * y, [newS[idx] for idx in cmb]) +for cmb in itertools.combinations(list(name_counter.values()), 3): +    ans += functools.reduce(operator.mul, cmb)