fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = (1..n).map { readLine()!!.first() }
        .plus("MARCH".toList()).filter { it in "MARCH" }.groupBy { it }.map { it.value.size.toLong()-1 }


    var ans = 0L
    for(i in 0..4)for(j in i+1..4)for(k in j+1..4){
        ans+=s[i]*s[j]*s[k]
    }
    println(ans)
}