#include<bits/stdc++.h> using namespace std; int n,m,c,o,i; string s; int main(){ scanf("%d",&n); for(int j=1;j<=n;j++){ cin>>s; if(s[0]=='M') m++; if(s[0]=='C') c++; if(s[0]=='O') o++; if(s[0]=='i') i++; } printf("%d",m*c*o*i); return 0; }