fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val n = sc.nextInt()
    val ss = sc.asSequence().take(n).toList()
    val march = "MARCH".asSequence().map { it to ss.filter { s -> s[0] == it }.count() }.toMap()

    var ret = 0L
    for (f in 1 until 2 * 2 * 2 * 2 * 2) {
        var len = 0
        var ptn = 1L
        for (shift in 0 until 5) {
            if (f and (1 shl shift) != 0) {
                len++
                ptn *= march["MARCH"[shift]] ?: 0
            }
        }
        if (len == 3) {
            ret += ptn
        }
    }
    println(ret)
}
