fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val ss = Array(n) { readLine()!![0] }.filter { it in listOf('M', 'A', 'R', 'C', 'H') }.groupBy { it }

    if (ss.entries.size < 3) {
        println(0)
        return
    }

    val keys = ss.keys.toList()
    var cnt = 0L

    for (i in 0..keys.size-3) {
        for (j in i+1..keys.size-2) {
            for (k in j+1..keys.size-1) {
                val key1 = keys[i]
                val key2 = keys[j]
                val key3 = keys[k]

                cnt += ss[key1]!!.size.toLong() * ss[key2]!!.size.toLong() * ss[key3]!!.size.toLong()
            }
        }
    }

    println(cnt)
}