"use strict";

//　組み合わせ(被りなし)
const combineWithoutRepetitions = (comboOptions, comboLength) => {
  if (comboLength === 1) {
    return comboOptions.map(comboOption => [comboOption]);
  }

  // Init combinations array.
  const combos = [];

  // Eliminate characters one by one and concatenate them to
  // combinations of smaller lengths.
  comboOptions.forEach((currentOption, optionIndex) => {
    const smallerCombos = combineWithoutRepetitions(
      comboOptions.slice(optionIndex + 1),
      comboLength - 1
    );

    smallerCombos.forEach((smallerCombo) => {
      combos.push([currentOption].concat(smallerCombo));
    });
  });

  return combos;
}

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const names = arg.slice(1, N + 1).filter(n => {
        if(n[0] === "M" ||
        n[0] === "A" ||
        n[0] === "R" ||
        n[0] === "C" ||
        n[0] === "H") {
            return true;
        }
    });
    
    if(!names.length) {
        console.log(0);
        return;
    }

    const initial = names.map(n=>n[0]);
    const iniSet  = new Set(initial);
    const duplicate = (names.length - [...iniSet].length) * 2;

    let allComb = combineWithoutRepetitions(names, 3);
    
    console.log(allComb.length - (names.length - duplicate));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));