'use strict'

function main(s) {

  s = s.split('\n');

  const n = Number(s[0]);
  const names = s.slice(1, -1);

  let ans = 0;

  const bfs = (i, list) => {
    if (i === n || list.length === 3) {
      const has = [0, 0, 0, 0, 0];

      for (const name of list) {
        if (name.charAt(0) === 'M') has[0] += 1;
        if (name.charAt(0) === 'A') has[1] += 1;
        if (name.charAt(0) === 'R') has[2] += 1;
        if (name.charAt(0) === 'C') has[3] += 1;
        if (name.charAt(0) === 'H') has[4] += 1;
      }

      const num = has.filter(c => c === 1).length;
      const sum = has.reduce((a, b) => a + b);n

      if (num === 3 && sum === 3) ans += 1;

      return;
    }

    bfs(i + 1, [...list, names[i]]);
    bfs(i + 1, list);
    
    return;
  }

  bfs(0, []);

  console.log(ans);

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
