Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[input() for i in range(n)]

dic={}
for i in s:
    if i[0]=='M' or i[0]=='A' or i[0]=='R' or i[0]=='C' or i[0]=='H':
        if i[0] in dic:
            dic[i[0]]+=1
        else:
            dic[i[0]]=1
if len(dic)<3:
    ans=0
else:
    if len(dic)==3:
        ans = 1
        for i in dic.values():
            ans *=i
    elif len(dic)==4:
        li4 = []
        for i in dic.values():
            li4.append(i)
        ans = li4[0]*li4[1]*li4[2]+li4[0]*li4[1]*li4[3]+li4[0]*li4[2]*li4[3]+li4[1]*li4[2]*li4[3]
    else:
        li4 = []
        for i in dic.values():
            li5.append(i)
        ans =li5[0]*li5[1]*li5[2]+li5[0]*li5[1]*li5[3]+li5[0]*li5[1]*li5[4]+li5[0]*li5[2]*li5[3]+li5[0]*li5[2]*li5[4]+li5[0]*li5[3]*li5[4]+li5[1]*li5[2]*li5[3]+li5[1]*li5[2]*li5[4]+li5[1]*li5[3]*li5[4]+li5[2]*li5[3]*li5[4]
print(ans)


Fixed submission:
n=int(input())
s=[input() for i in range(n)]

dic={}
for i in s:
    if i[0]=='M' or i[0]=='A' or i[0]=='R' or i[0]=='C' or i[0]=='H':
        if i[0] in dic:
            dic[i[0]]+=1
        else:
            dic[i[0]]=1
if len(dic)<3:
    ans=0
else:
    if len(dic)==3:
        ans = 1
        for i in dic.values():
            ans *=i
    elif len(dic)==4:
        li4 = []
        for i in dic.values():
            li4.append(i)
        ans = li4[0]*li4[1]*li4[2]+li4[0]*li4[1]*li4[3]+li4[0]*li4[2]*li4[3]+li4[1]*li4[2]*li4[3]
    else:
        li5 = []
        for i in dic.values():
            li5.append(i)
        ans =li5[0]*li5[1]*li5[2]+li5[0]*li5[1]*li5[3]+li5[0]*li5[1]*li5[4]+li5[0]*li5[2]*li5[3]+li5[0]*li5[2]*li5[4]+li5[0]*li5[3]*li5[4]+li5[1]*li5[2]*li5[3]+li5[1]*li5[2]*li5[4]+li5[1]*li5[3]*li5[4]+li5[2]*li5[3]*li5[4]
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[input() for i in range(n)]

dic={}
for i in s:
    if i[0]=='M' or i[0]=='A' or i[0]=='R' or i[0]=='C' or i[0]=='H':
        if i[0] in dic:
            dic[i[0]]+=1
        else:
            dic[i[0]]=1
if len(dic)<3:
    ans=0
else:
    if len(dic)==3:
        ans = 1
        for i in dic.values():
            ans *=i
    elif len(dic)==4:
        li4 = []
        for i in dic.values():
            li4.append(i)
        ans = li4[0]*li4[1]*li4[2]+li4[0]*li4[1]*li4[3]+li4[0]*li4[2]*li4[3]+li4[1]*li4[2]*li4[3]
    else:
        li4 = []
        for i in dic.values():
            li5.append(i)
        ans =li5[0]*li5[1]*li5[2]+li5[0]*li5[1]*li5[3]+li5[0]*li5[1]*li5[4]+li5[0]*li5[2]*li5[3]+li5[0]*li5[2]*li5[4]+li5[0]*li5[3]*li5[4]+li5[1]*li5[2]*li5[3]+li5[1]*li5[2]*li5[4]+li5[1]*li5[3]*li5[4]+li5[2]*li5[3]*li5[4]
print(ans)


Fixed submission:
n=int(input())
s=[input() for i in range(n)]

dic={}
for i in s:
    if i[0]=='M' or i[0]=='A' or i[0]=='R' or i[0]=='C' or i[0]=='H':
        if i[0] in dic:
            dic[i[0]]+=1
        else:
            dic[i[0]]=1
if len(dic)<3:
    ans=0
else:
    if len(dic)==3:
        ans = 1
        for i in dic.values():
            ans *=i
    elif len(dic)==4:
        li4 = []
        for i in dic.values():
            li4.append(i)
        ans = li4[0]*li4[1]*li4[2]+li4[0]*li4[1]*li4[3]+li4[0]*li4[2]*li4[3]+li4[1]*li4[2]*li4[3]
    else:
        li5 = []
        for i in dic.values():
            li5.append(i)
        ans =li5[0]*li5[1]*li5[2]+li5[0]*li5[1]*li5[3]+li5[0]*li5[1]*li5[4]+li5[0]*li5[2]*li5[3]+li5[0]*li5[2]*li5[4]+li5[0]*li5[3]*li5[4]+li5[1]*li5[2]*li5[3]+li5[1]*li5[2]*li5[4]+li5[1]*li5[3]*li5[4]+li5[2]*li5[3]*li5[4]
print(ans)