import scala.io.StdIn
object Main extends App {
  
  val n = StdIn.readLine().toInt
  val linse = (0 until n).map(_ => StdIn.readLine())
  
  val combis = List('M','A','R','C','H').combinations(3)

  val members = linse.filter{p =>
    p.charAt(0) == 'M' || p.charAt(0) == 'A' || p.charAt(0) == 'R' || p.charAt(0) == 'C' || p.charAt(0) == 'H'
  }.groupBy(name => name.charAt(0)).map(a => a._1 -> a._2.size)

  //val combi = members.keys.toList.combinations(3)
  //println(combi.mkString(" "))

  val result = combis.foldLeft(0L){ (acc, l) =>
    acc + (members.get(l(0)).getOrElse(0).toLong * 
      members.get(l(1)).getOrElse(0).toLong * members.get(l(2)).getOrElse(0).toLong)
  }

  println(result)

}