n=io.read("*n","*l")
s={}
for i=1,n do
    initial=io.read():sub(1,1)
    if initial=="M" or initial=="A" or initial=="R" or initial=="C" or initial=="H" then
        if not s[initial] then
            s[initial]=1
        else
            s[initial]=s[initial]+1
        end
    end
end

combination=0
for i,_ in pairs(s) do
    for j,_ in pairs(s) do
        for k,_ in pairs(s) do
            if i<j and j<k then
                combination=combination+s[i]*s[j]*s[k]
            end
        end
    end
end
print(combination)