fun main(args: Array<String>) {
    val chars = charArrayOf('M', 'A', 'R', 'C', 'H')
    val n = readLine()!!.toInt()
    val cm = hashMapOf<Char, Long>()
    repeat(n) {
        val c = readLine()!!.first()
        if (c in chars) cm[c] = (cm.getOrElse(c) {0L}) + 1L
    }
    if (cm.size < 3) {
        println(0)
        return
    }
    val cnt = cm.values.toList()
    var ans = 0L
    for (i in 0 until cnt.size - 2) {
        for (j in i + 1 until cnt.size - 1) {
            for (k in j + 1 until cnt.size) {
                ans += cnt[i] * cnt[j] * cnt[k]
            }
        }
    }
    println(ans)
}
