output_description: If there are x ways to choose three people so that the given conditions are
  met, print x.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      S_1
      :
      S_N
attempt: #include<iostream>
  #include<algorithm>
  #include<string>
  #include<vector>
  #include<queue>
  #include<map>
  #include<math.h>
  
  #define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
  #define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)
  
  #define INF 100000000
  #define MOD 1000000007
  
  typedef  long long ll;
  
  using namespace std;
  
  double euclid_distance(double a,double b){
      return sqrt(a*a+b*b);
  }
  
  int gcd(long long int a,long long int b){
      long long int r;
      if(a < b){
          int tmp;
          tmp = a;
          a = b;
          b = tmp;
      }
      while(r != 0){
          r = a % b;
          a = b;
          b = r;
      }
      return r;
  }
  
  void Integer_factorization(ll factor[],ll n){
      ll a = 2;
      bool flag = false;
      for(int p = 2;p*p <= n;p++){
          while(n%p == 0){
              n/=p;
              factor[p]++;
          }
      }
      if(n!=1)  factor[n]++; //prime num
  }
  
  void ys(){
      cout << "Yes" << endl;
  }
  
  void yb(){
      cout << "YES" << endl;
  }
  
  void ns(){
      cout << "No" << endl;
  }
  
  void nb(){
      cout << "NO" << endl;
  }
  
  
  void solve(void){
     ll n;
     cin >> n;
     ll d[5] = {0};
     int a[10] = {0,0,0,0,0,0,1,1,1,2};
     int b[10] = {1,1,1,2,2,3,2,2,3,3};
     int c[10] = {2,3,4,3,4,4,3,4,4,4};
  
     rep(i,0,n){
         string s;
         cin >> s;
         if(s[0] == 'M') d[0]++;
         if(s[0] == 'A') d[1]++;
         if(s[0] == 'R') d[2]++;
         if(s[0] == 'C') d[3]++;
         if(s[0] == 'H') d[4]++;
     }
     ll ans = 0;
     rep(i,0,10){
         ans += d[a[i]]*d[b[i]]*d[c[i]]; 
     }
     
     cout << ans <<endl;
  }
  int main(){
      cin.tie(0);
      ios::sync_with_stdio(false);
      solve();
  }
problem_description: Statement
  
  There are N people. The name of the i-th person is S_i.
  
  We would like to choose three people so that the following conditions are met:
  
    * The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`.
    * There are no multiple people whose names begin with the same letter.
  
  How many such ways are there to choose three people, disregarding order?
  
  Note that the answer may not fit into a 32-bit integer type.
samples: [{"input": "5\n    MASHIKE\n    RUMOI\n    OBIRA\n    HABORO\n    HOROKANAI", "output": "2\n    \n\nWe can choose three people with the following names:\n\n  * `MASHIKE`, `RUMOI`, `HABORO`\n\n  * `MASHIKE`, `RUMOI`, `HOROKANAI`\n\nThus, we have two ways.\n\n* * *"}, {"input": "4\n    ZZ\n    ZZZ\n    Z\n    ZZZZZZZZZZ", "output": "0\n    \n\nNote that there may be no ways to choose three people so that the given\nconditions are met.\n\n* * *"}, {"input": "5\n    CHOKUDAI\n    RNG\n    MAKOTO\n    AOKI\n    RINGO", "output": "7"}]