from itertools import combinations

from collections import Counter



n = int(eval(input()))

S = Counter()

for i in range(n):

  S[input()[0]] +=  1 # Counter == dictionary

  

print((sum([S[a]*S[b]*S[c] for a, b, c in combinations("MARCH", 3)])))  
from collections import defaultdict

from itertools import combinations



N = int(eval(input()))

S = [input()[0] for _ in range(N)]

dic_S = defaultdict(int)

for s in S:

  if s in "MARCH":

    dic_S[s] += 1



ans = 0

for a, b, c in combinations(list(dic_S.values()), 3):

  ans += a*b*c

  

print(ans)  

  

from itertools import combinations
from collections import Counter

n = int(eval(input()))
S = Counter()
for i in range(n):
    S[input()[0]] += 1  # Counter == dictionary
print((sum([S[a] * S[b] * S[c] for a, b, c in combinations("MARCH", 3)])))

from collections import defaultdict
from itertools import combinations

N = int(eval(input()))
S = [input()[0] for _ in range(N)]
dic_S = defaultdict(int)
for s in S:
    if s in "MARCH":
        dic_S[s] += 1
ans = 0
for a, b, c in combinations(list(dic_S.values()), 3):
    ans += a * b * c
print(ans)

+from collections import defaultdict -from collections import Counter -n = int(eval(input())) -S = Counter() -for i in range(n): -    S[input()[0]] += 1  # Counter == dictionary -print((sum([S[a] * S[b] * S[c] for a, b, c in combinations("MARCH", 3)]))) +N = int(eval(input())) +S = [input()[0] for _ in range(N)] +dic_S = defaultdict(int) +for s in S: +    if s in "MARCH": +        dic_S[s] += 1 +ans = 0 +for a, b, c in combinations(list(dic_S.values()), 3): +    ans += a * b * c +print(ans)