#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"from itertools import*;s,*_=zip(*open(0).readlines());print(sum(p*q*r for p,q,r in combinations(map(s.count,'MARCH'),3)))\n"
"\"";
  system(s);
  return 0;
}            