#                         author:  kagemeka 

#                         created: 2019-11-06 16:52:04(JST)

import sys

# import collections

# import math

# import string

# import bisect

# import re

import itertools

# import statistics

# import functools

# import operator



# def nCr(n, r):

#     r = min(r, n - r)

#     return functools.reduce(operator.mul, range(n, n-r, -1), 1) // math.factorial(r)



def main():

    n = int(sys.stdin.readline().rstrip())

    march = {l: 0 for l in 'MARCH'}



    for i in range(n):

        initial = sys.stdin.readline()[0]

        if initial in march:

            march[initial] += 1





    march = {k: v for k, v in list(march.items()) if v != 0}

    

    if len(march) < 2:

        print((0))

        exit()

    

    total_cmb = 0

    for cmb in itertools.combinations(list(march.values()), 3):

        total_cmb += cmb[0] * cmb[1] * cmb[2]

    

    print(total_cmb)

        

if __name__ == "__main__":

    # execute only if run as a script

    main()

import sys

from collections import Counter

from itertools import combinations



MARCH = set('MARCH')



n = int(sys.stdin.readline().rstrip())

s = [x[0] for x in sys.stdin.read().split() if x[0] in MARCH]



def main():

    c = Counter(s)

    ways = 0

    for comb in combinations('MARCH', 3):

        res = 1

        for i in comb:

            res *= c.get(i, 0)

        ways += res

    

    return ways



if __name__ == '__main__':

    ans = main()

    print(ans)
#                         author:  kagemeka
#                         created: 2019-11-06 16:52:04(JST)
import sys

# import collections
# import math
# import string
# import bisect
# import re
import itertools

# import statistics
# import functools
# import operator
# def nCr(n, r):
#     r = min(r, n - r)
#     return functools.reduce(operator.mul, range(n, n-r, -1), 1) // math.factorial(r)
def main():
    n = int(sys.stdin.readline().rstrip())
    march = {l: 0 for l in "MARCH"}
    for i in range(n):
        initial = sys.stdin.readline()[0]
        if initial in march:
            march[initial] += 1
    march = {k: v for k, v in list(march.items()) if v != 0}
    if len(march) < 2:
        print((0))
        exit()
    total_cmb = 0
    for cmb in itertools.combinations(list(march.values()), 3):
        total_cmb += cmb[0] * cmb[1] * cmb[2]
    print(total_cmb)


if __name__ == "__main__":
    # execute only if run as a script
    main()

import sys
from collections import Counter
from itertools import combinations

MARCH = set("MARCH")
n = int(sys.stdin.readline().rstrip())
s = [x[0] for x in sys.stdin.read().split() if x[0] in MARCH]


def main():
    c = Counter(s)
    ways = 0
    for comb in combinations("MARCH", 3):
        res = 1
        for i in comb:
            res *= c.get(i, 0)
        ways += res
    return ways


if __name__ == "__main__":
    ans = main()
    print(ans)

-#                         author:  kagemeka -#                         created: 2019-11-06 16:52:04(JST) +from collections import Counter +from itertools import combinations -# import collections -# import math -# import string -# import bisect -# import re -import itertools +MARCH = set("MARCH") +n = int(sys.stdin.readline().rstrip()) +s = [x[0] for x in sys.stdin.read().split() if x[0] in MARCH] -# import statistics -# import functools -# import operator -# def nCr(n, r): -#     r = min(r, n - r) -#     return functools.reduce(operator.mul, range(n, n-r, -1), 1) // math.factorial(r) + -    n = int(sys.stdin.readline().rstrip()) -    march = {l: 0 for l in "MARCH"} -    for i in range(n): -        initial = sys.stdin.readline()[0] -        if initial in march: -            march[initial] += 1 -    march = {k: v for k, v in list(march.items()) if v != 0} -    if len(march) < 2: -        print((0)) -        exit() -    total_cmb = 0 -    for cmb in itertools.combinations(list(march.values()), 3): -        total_cmb += cmb[0] * cmb[1] * cmb[2] -    print(total_cmb) +    c = Counter(s) +    ways = 0 +    for comb in combinations("MARCH", 3): +        res = 1 +        for i in comb: +            res *= c.get(i, 0) +        ways += res +    return ways -    # execute only if run as a script -    main() +    ans = main() +    print(ans)