N=io.read("n")
local t={M=0,A=0,R=0,C=0,H=0}
for i=1,N do
  local s=io.read()
  local f=string.sub(s,1,1)
  t[f]=t[f]+1 or nil
end
a1 =t[M]*t[A]*t[R]
a2 =t[M]*t[A]*t[C]
a3 =t[M]*t[A]*t[H]
a4 =t[M]*t[R]*t[C]
a5 =t[M]*t[R]*t[H]
a6 =t[M]*t[C]*t[H]
a7 =t[A]*t[R]*t[C]
a8 =t[A]*t[R]*t[H]
a9 =t[A]*t[C]*t[H]
a10=t[R]*t[C]*t[H]
print(a1+a2+a3+a4+a5+a6+a7+a8+a9+a10)