import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  val n = br.readLine().toInt()
  val ref = "MARCH"

  val table = LongArray(ref.length)
  for(i in 1..n) {
    val s = br.readLine().first()
    val idx = ref.indexOf(s)
    if(idx != -1)
      table[idx]++
  }

  fun compute():Long {
    var acc = 0L
    for(i in ref.indices)
      for(j in i+1..ref.lastIndex)
        for(k in j+1..ref.lastIndex) {
          acc += table[i] * table[j] * table[k]
        }
    return acc
  }

  val ans = compute()
  println(ans)
}