# -*- coding: utf-8 -*-

from collections import defaultdict

from itertools import combinations

N = int(eval(input()))

C = [0, 0, 0, 0, 0, 0]

D = defaultdict(int)

for i, m in enumerate("MARCH", start=1):

    D[m] = i



for _ in range(N):

    C[D[input()[0]]] += 1



ans = 0

for a, b, c in combinations(list(range(1, 6)), r=3):

    ans += C[a]*C[b]*C[c]

print(ans)
from collections import defaultdict

from itertools import combinations

def inpl(): return list(map(int, input().split()))



C = defaultdict(int)

N = int(eval(input()))

for _ in range(N):

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



res = 0

for H in combinations("MARCH", r=3):

    res += C[H[0]] * C[H[1]] * C[H[2]]

print(res)
# -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import combinations

N = int(eval(input()))
C = [0, 0, 0, 0, 0, 0]
D = defaultdict(int)
for i, m in enumerate("MARCH", start=1):
    D[m] = i
for _ in range(N):
    C[D[input()[0]]] += 1
ans = 0
for a, b, c in combinations(list(range(1, 6)), r=3):
    ans += C[a] * C[b] * C[c]
print(ans)

from collections import defaultdict
from itertools import combinations


def inpl():
    return list(map(int, input().split()))


C = defaultdict(int)
N = int(eval(input()))
for _ in range(N):
    C[input()[0]] += 1
res = 0
for H in combinations("MARCH", r=3):
    res += C[H[0]] * C[H[1]] * C[H[2]]
print(res)

-# -*- coding: utf-8 -*- + +def inpl(): +    return list(map(int, input().split())) + + +C = defaultdict(int) -C = [0, 0, 0, 0, 0, 0] -D = defaultdict(int) -for i, m in enumerate("MARCH", start=1): -    D[m] = i -    C[D[input()[0]]] += 1 -ans = 0 -for a, b, c in combinations(list(range(1, 6)), r=3): -    ans += C[a] * C[b] * C[c] -print(ans) +    C[input()[0]] += 1 +res = 0 +for H in combinations("MARCH", r=3): +    res += C[H[0]] * C[H[1]] * C[H[2]] +print(res)