fun main(args : Array<String>) {
        val l = (1..readLine()!!.toInt()).map { readLine()!![0] }.run {
            listOf(count { it == 'M' }, count { it == 'A' }, count { it == 'R' }, count { it == 'C' }, count { it == 'H' })
                    .map { it.toLong() }
                    .filter { it != 0L }
        }
        print((0 until l.size - 2).map { i ->
                    (i + 1 until l.size - 1).map { j ->
                        (j + 1 until l.size).map { k -> l[i] * l[j] * l[k] }.sum()
                    }.sum()
                }.sum())
}