from itertools import combinations

from collections import Counter

n = int(eval(input()))

S = Counter()

for i in range(n):

    S[input()[0]]+=1

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

n = int(eval(input()))

s = [eval(input()) for i in range(n)]

s = [s[i][0] for i in range(n)]

d=[0]*128

for t in s:

    d[ord(t[0])]+=1

print((sum(p*q*r for p,q,r in combinations([d[ord(t)] for t in'MARCH'],3))))
from itertools import combinations
from collections import Counter

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

from itertools import *

n = int(eval(input()))
s = [eval(input()) for i in range(n)]
s = [s[i][0] for i in range(n)]
d = [0] * 128
for t in s:
    d[ord(t[0])] += 1
print((sum(p * q * r for p, q, r in combinations([d[ord(t)] for t in "MARCH"], 3))))

-from itertools import combinations -from collections import Counter +from itertools import * -S = Counter() -for i in range(n): -    S[input()[0]] += 1 -print((sum(S[a] * S[b] * S[c] for a, b, c in combinations("MARCH", 3)))) +s = [eval(input()) for i in range(n)] +s = [s[i][0] for i in range(n)] +d = [0] * 128 +for t in s: +    d[ord(t[0])] += 1 +print((sum(p * q * r for p, q, r in combinations([d[ord(t)] for t in "MARCH"], 3))))