#include<bits/stdc++.h>
using namespace std;
string z;
int M,A,R,C,H;
int main(){
    while(cin>>z){
        if(z[0]=='M')M++;
        if(z[0]=='A')A++;
        if(z[0]=='R')R++;
        if(z[0]=='C')C++;
        if(z[0]=='H')H++;
    }
    long long int a=C+H,b=A+R,c=A*R,d=C*H;
    cout<<c*(M+a)+d*(M+b)+(M*a*b)<<endl;
}
