N = int(eval(input()))

D = {"M":0, "A":0, "R":0, "C":0, "H":0}

for i in range(N):

    a = eval(input())

    if a[0] in D:

        D[a[0]] += 1

L = [D["M"], D["A"], D["R"], D["C"], D["H"]]

ans = 0

for i in range(3):

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

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

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

print(ans)
import sys



def solve():

    input = sys.stdin.readline

    nameCount = [0] * 5

    N = int(eval(input()))

    for _ in range(N):

        s = input().strip("\n")

        if s[0] == "M": nameCount[0] += 1

        elif s[0] == "A": nameCount[1] += 1

        elif s[0] == "R": nameCount[2] += 1

        elif s[0] == "C": nameCount[3] += 1

        elif s[0] == "H": nameCount[4] += 1

        else: continue

    Ans = 0

    for i in range(3):

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

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

                Ans += nameCount[i] * nameCount[j] * nameCount[k]

    print(Ans)





    return 0



if __name__ == "__main__":

    solve()
N = int(eval(input()))
D = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for i in range(N):
    a = eval(input())
    if a[0] in D:
        D[a[0]] += 1
L = [D["M"], D["A"], D["R"], D["C"], D["H"]]
ans = 0
for i in range(3):
    for j in range(i + 1, 4):
        for k in range(j + 1, 5):
            ans += L[i] * L[j] * L[k]
print(ans)

import sys


def solve():
    input = sys.stdin.readline
    nameCount = [0] * 5
    N = int(eval(input()))
    for _ in range(N):
        s = input().strip("\n")
        if s[0] == "M":
            nameCount[0] += 1
        elif s[0] == "A":
            nameCount[1] += 1
        elif s[0] == "R":
            nameCount[2] += 1
        elif s[0] == "C":
            nameCount[3] += 1
        elif s[0] == "H":
            nameCount[4] += 1
        else:
            continue
    Ans = 0
    for i in range(3):
        for j in range(i + 1, 4):
            for k in range(j + 1, 5):
                Ans += nameCount[i] * nameCount[j] * nameCount[k]
    print(Ans)
    return 0


if __name__ == "__main__":
    solve()

-N = int(eval(input())) -D = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} -for i in range(N): -    a = eval(input()) -    if a[0] in D: -        D[a[0]] += 1 -L = [D["M"], D["A"], D["R"], D["C"], D["H"]] -ans = 0 -for i in range(3): -    for j in range(i + 1, 4): -        for k in range(j + 1, 5): -            ans += L[i] * L[j] * L[k] -print(ans) +import sys + + +def solve(): +    input = sys.stdin.readline +    nameCount = [0] * 5 +    N = int(eval(input())) +    for _ in range(N): +        s = input().strip("\n") +        if s[0] == "M": +            nameCount[0] += 1 +        elif s[0] == "A": +            nameCount[1] += 1 +        elif s[0] == "R": +            nameCount[2] += 1 +        elif s[0] == "C": +            nameCount[3] += 1 +        elif s[0] == "H": +            nameCount[4] += 1 +        else: +            continue +    Ans = 0 +    for i in range(3): +        for j in range(i + 1, 4): +            for k in range(j + 1, 5): +                Ans += nameCount[i] * nameCount[j] * nameCount[k] +    print(Ans) +    return 0 + + +if __name__ == "__main__": +    solve()