object Main extends App {
  import scala.io.StdIn._
  val n = readInt
  val names = Array.fill(n){readLine.trim}.filter(name ⇒ "MARCH".contains(name.head)).groupBy(_.head).mapValues(_.length.toLong).withDefault(_ ⇒ 0L)
  println("MARCH".combinations(3).map{str ⇒ str.map(names).product}.sum)
}