N = int(eval(input()))

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



from itertools import combinations

c = list(combinations([i for i in range(5)],3))



cnt = [0]*6

for i in range(N):

    cnt["MARCH".find(S[i][0])] += 1



ans = 0

for (i,j,k) in c:

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



print(ans)
from collections import defaultdict

from itertools import combinations



N = int(eval(input()))

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



dic = defaultdict(int)

for s in S:

    dic[s[0]] += 1



comb = combinations("MARCH", 3)



ans = 0

for x1,x2,x3 in comb:

    ans += dic[x1]*dic[x2]*dic[x3]



print(ans)

N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
from itertools import combinations

c = list(combinations([i for i in range(5)], 3))
cnt = [0] * 6
for i in range(N):
    cnt["MARCH".find(S[i][0])] += 1
ans = 0
for (i, j, k) in c:
    ans += cnt[i] * cnt[j] * cnt[k]
print(ans)

from collections import defaultdict
from itertools import combinations

N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
dic = defaultdict(int)
for s in S:
    dic[s[0]] += 1
comb = combinations("MARCH", 3)
ans = 0
for x1, x2, x3 in comb:
    ans += dic[x1] * dic[x2] * dic[x3]
print(ans)

+from collections import defaultdict +from itertools import combinations + -from itertools import combinations - -c = list(combinations([i for i in range(5)], 3)) -cnt = [0] * 6 -for i in range(N): -    cnt["MARCH".find(S[i][0])] += 1 +dic = defaultdict(int) +for s in S: +    dic[s[0]] += 1 +comb = combinations("MARCH", 3) -for (i, j, k) in c: -    ans += cnt[i] * cnt[j] * cnt[k] +for x1, x2, x3 in comb: +    ans += dic[x1] * dic[x2] * dic[x3]