def main():

    N = int(eval(input()))

    ans = []

    for i in range(N):

        s = eval(input())

        if s[0] in ["M", "A", "R", "C", "H"]:

            ans.append(s[0])

    from collections import Counter

    c = Counter(ans)

    ret = 0

    from itertools import combinations

    for com in combinations(list(c.values()), 3):

        ret += com[0]*com[1]*com[2]

    print(ret)





if __name__ == '__main__':

    main()

def main():

    N = int(eval(input()))

    A = [eval(input()) for i in range(N)]

    from itertools import combinations

    S = {"M": 0, "A": 1, "R": 2, "C": 3, "H": 4}

    ans = 0

    cnt = [0]*5

    for a in A:

        c = a[0]

        if c in list(S.keys()):

            cnt[S[c]] += 1

    for comb in combinations(list(range(5)), 3):

        ans += cnt[comb[0]]*cnt[comb[1]]*cnt[comb[2]]

    print(ans)





if __name__ == '__main__':

    main()

def main():
    N = int(eval(input()))
    ans = []
    for i in range(N):
        s = eval(input())
        if s[0] in ["M", "A", "R", "C", "H"]:
            ans.append(s[0])
    from collections import Counter

    c = Counter(ans)
    ret = 0
    from itertools import combinations

    for com in combinations(list(c.values()), 3):
        ret += com[0] * com[1] * com[2]
    print(ret)


if __name__ == "__main__":
    main()

def main():
    N = int(eval(input()))
    A = [eval(input()) for i in range(N)]
    from itertools import combinations

    S = {"M": 0, "A": 1, "R": 2, "C": 3, "H": 4}
    ans = 0
    cnt = [0] * 5
    for a in A:
        c = a[0]
        if c in list(S.keys()):
            cnt[S[c]] += 1
    for comb in combinations(list(range(5)), 3):
        ans += cnt[comb[0]] * cnt[comb[1]] * cnt[comb[2]]
    print(ans)


if __name__ == "__main__":
    main()

-    ans = [] -    for i in range(N): -        s = eval(input()) -        if s[0] in ["M", "A", "R", "C", "H"]: -            ans.append(s[0]) -    from collections import Counter - -    c = Counter(ans) -    ret = 0 +    A = [eval(input()) for i in range(N)] -    for com in combinations(list(c.values()), 3): -        ret += com[0] * com[1] * com[2] -    print(ret) +    S = {"M": 0, "A": 1, "R": 2, "C": 3, "H": 4} +    ans = 0 +    cnt = [0] * 5 +    for a in A: +        c = a[0] +        if c in list(S.keys()): +            cnt[S[c]] += 1 +    for comb in combinations(list(range(5)), 3): +        ans += cnt[comb[0]] * cnt[comb[1]] * cnt[comb[2]] +    print(ans)