n=int(eval(input()))

s=[]

m=0

a=0

r=0

c=0

h=0

for i in range(n):

  b=str(eval(input()))[0]

  if b=="M":m+=1

  elif b=="A":a+=1

  elif b=="R":r+=1

  elif b=="C":c+=1

  elif b=="H":h+=1

  s.append(b)



ans=0



ans+=m*a*r

ans+=m*a*c

ans+=m*a*h

ans+=m*r*c

ans+=m*r*h

ans+=m*c*h

ans+=a*r*c

ans+=a*r*h

ans+=a*c*h

ans+=r*c*h     

print(ans)
import itertools

N = int(eval(input()))

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

caps = ['M', 'A', 'R', 'C', 'H']

a = [0] * 5

ans = 0

for s in S:

    if s[0] in caps:

        a[caps.index(s[0])] += 1

c = list(itertools.combinations((0, 1, 2, 3, 4), 3))

for i in range(len(c)):

    ans += a[c[i][0]] * a[c[i][1]] * a[c[i][2]]

print(ans)
n = int(eval(input()))
s = []
m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(n):
    b = str(eval(input()))[0]
    if b == "M":
        m += 1
    elif b == "A":
        a += 1
    elif b == "R":
        r += 1
    elif b == "C":
        c += 1
    elif b == "H":
        h += 1
    s.append(b)
ans = 0
ans += m * a * r
ans += m * a * c
ans += m * a * h
ans += m * r * c
ans += m * r * h
ans += m * c * h
ans += a * r * c
ans += a * r * h
ans += a * c * h
ans += r * c * h
print(ans)

import itertools

N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
caps = ["M", "A", "R", "C", "H"]
a = [0] * 5
ans = 0
for s in S:
    if s[0] in caps:
        a[caps.index(s[0])] += 1
c = list(itertools.combinations((0, 1, 2, 3, 4), 3))
for i in range(len(c)):
    ans += a[c[i][0]] * a[c[i][1]] * a[c[i][2]]
print(ans)

-n = int(eval(input())) -s = [] -m = 0 -a = 0 -r = 0 -c = 0 -h = 0 -for i in range(n): -    b = str(eval(input()))[0] -    if b == "M": -        m += 1 -    elif b == "A": -        a += 1 -    elif b == "R": -        r += 1 -    elif b == "C": -        c += 1 -    elif b == "H": -        h += 1 -    s.append(b) +import itertools + +N = int(eval(input())) +S = [eval(input()) for _ in range(N)] +caps = ["M", "A", "R", "C", "H"] +a = [0] * 5 -ans += m * a * r -ans += m * a * c -ans += m * a * h -ans += m * r * c -ans += m * r * h -ans += m * c * h -ans += a * r * c -ans += a * r * h -ans += a * c * h -ans += r * c * h +for s in S: +    if s[0] in caps: +        a[caps.index(s[0])] += 1 +c = list(itertools.combinations((0, 1, 2, 3, 4), 3)) +for i in range(len(c)): +    ans += a[c[i][0]] * a[c[i][1]] * a[c[i][2]]