N = int(eval(input()))

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



MARCH = [0] * 5

for i in range(N):

    if S[i][0] == 'M' : MARCH[0] += 1

    if S[i][0] == 'A' : MARCH[1] += 1

    if S[i][0] == 'R' : MARCH[2] += 1

    if S[i][0] == 'C' : MARCH[3] += 1

    if S[i][0] == 'H' : MARCH[4] += 1

    

ans = 0

for i in range(3):

    for j in range(i+1,4):

        for k in range(j+1,5):

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

            

print(ans)

    



N = int(eval(input()))

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



mydict = {'M':1,'A':2,'R':3,'C':4,'H':5}

count = [0] * 6

for i in range(N):

    s = S[i][0]

    if s in mydict:

        count[mydict[s]] += 1

ans = 0

for i in range(1,6):

    for j in range(i+1,6):

        if i==j:continue

        for k in range(j+1,6):

            if i==k or j == k:continue

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

            

            

print(ans)

            

            
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
MARCH = [0] * 5
for i in range(N):
    if S[i][0] == "M":
        MARCH[0] += 1
    if S[i][0] == "A":
        MARCH[1] += 1
    if S[i][0] == "R":
        MARCH[2] += 1
    if S[i][0] == "C":
        MARCH[3] += 1
    if S[i][0] == "H":
        MARCH[4] += 1
ans = 0
for i in range(3):
    for j in range(i + 1, 4):
        for k in range(j + 1, 5):
            ans += MARCH[i] * MARCH[j] * MARCH[k]
print(ans)

N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
mydict = {"M": 1, "A": 2, "R": 3, "C": 4, "H": 5}
count = [0] * 6
for i in range(N):
    s = S[i][0]
    if s in mydict:
        count[mydict[s]] += 1
ans = 0
for i in range(1, 6):
    for j in range(i + 1, 6):
        if i == j:
            continue
        for k in range(j + 1, 6):
            if i == k or j == k:
                continue
            ans += count[i] * count[j] * count[k]
print(ans)

-MARCH = [0] * 5 +mydict = {"M": 1, "A": 2, "R": 3, "C": 4, "H": 5} +count = [0] * 6 -    if S[i][0] == "M": -        MARCH[0] += 1 -    if S[i][0] == "A": -        MARCH[1] += 1 -    if S[i][0] == "R": -        MARCH[2] += 1 -    if S[i][0] == "C": -        MARCH[3] += 1 -    if S[i][0] == "H": -        MARCH[4] += 1 +    s = S[i][0] +    if s in mydict: +        count[mydict[s]] += 1 -for i in range(3): -    for j in range(i + 1, 4): -        for k in range(j + 1, 5): -            ans += MARCH[i] * MARCH[j] * MARCH[k] +for i in range(1, 6): +    for j in range(i + 1, 6): +        if i == j: +            continue +        for k in range(j + 1, 6): +            if i == k or j == k: +                continue +            ans += count[i] * count[j] * count[k]