fun main(args: Array<String>) {
    val countN = readLine().orEmpty().toInt()
    val nameList = mutableListOf(0,0,0,0,0)
    var result = 0L
    for(i in 0 until countN){
        val name = readLine().orEmpty()
        when(name[0]){
            'M' -> nameList[0] += 1
            'A' -> nameList[1] += 1
            'R' -> nameList[2] += 1
            'C' -> nameList[3] += 1
            'H' -> nameList[4] += 1
        }
    }
    var nya = 1L
    val distinctList = nameList
    distinctList.removeAll{it == 0}

    if(distinctList.size < 3){
        result = 0
    }else if(distinctList.size == 3){
        result = 1L
        distinctList.forEach{
            result *= it
        }

    }else if(distinctList.size >= 4){
        for(i in 0 until distinctList.size){
            nya = distinctList[i].toLong()
            for(j in 0 until distinctList.size){
                if(j > i){
                    val prenya2 = nya
                    nya *= distinctList[j]
                    for(k in 0 until distinctList.size){
                        if(k > j){
                            val prenya3 = nya
                            nya *= distinctList[k]
                            result += nya
                            nya = prenya3
                        }
                    }
                    nya = prenya2
                }
            }
        }
    }

    println(result)
}

