fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val count = (1..n).map {
        "MARCH".indexOf(readLine()!![0])
    }.groupBy { it }
    var ans = 0L
    for (i in 0 until 5) {
        for (j in i+1 until 5) {
            for (k in j+1 until 5) {
                val counti = (count[i]?.size ?: 0).toLong()
                val countj = (count[j]?.size ?: 0).toLong()
                val countk = (count[k]?.size ?: 0).toLong()
                ans += counti * countj * countk
            }
        }
    }
    println(ans)
}
