fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val map = mutableMapOf<Char, Long>()
    map['M'] = 0
    map['A'] = 0
    map['R'] = 0
    map['C'] = 0
    map['H'] = 0
    for (i in 0 until N) {
        val c = readLine()!![0]
        if (map.containsKey(c)) {
            map[c] = map[c]!! + 1
        }
    }
    val counter = map.values.toList()
    var sol: Long = 0
    for (i in 0 until 5) {
        for (j in i+1 until 5) {
            for (k in j+1 until 5) {
                sol += counter[i] * counter[j] * counter[k]
            }
        }
    }
    println(sol)
}