import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
  int N = to!int(readln.chomp);
  char[] name = ['M', 'A', 'R', 'C', 'H'];
  int[char] hash;

  foreach (long i; 0..N) {
    string s = readln;
    if (name.count(s[0])) {
      hash[s[0]]++;
    }
  }

  writeln(reduce!("a * b")(1, hash) * combination(cast(int)hash.length) - (3 == hash.length ? 0 : reduce!("a + b - 1")(0, hash)));
}

long combination(int n, int r = 3) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

long factorial(long n) {
  long ret = 1;
  for (long i = 1; i <= n; i++) {
    ret *= i;
  }

  return ret;
}

unittest {
  /* factorial */
  assert(factorial(3) == 6);
  assert(factorial(5) == 120);
}

