fun main(args: Array<String>) = yorukatsu18c()

fun yorukatsu18c() {
    val n = readLine()!!.toInt()
    val sList = Array(n) { readLine()!! }

    val initials = listOf('M', 'A', 'R', 'C', 'H')

    val counts = initials.map { initial -> sList.count { it.startsWith(initial) } }

    val answer = counts.indices.map { i ->
        (i + 1..counts.lastIndex).map { j ->
            (j + 1..counts.lastIndex).map { k ->
                counts[i].toLong() * counts[j] * counts[k]
            }
        }
    }.flatten().flatten().sum()

    println(answer)
}
