fun main(args: Array<String>) = println(run {
    val n = readLine()!!.toInt()
    val s = (1..n).map { readLine()!! }

    s.map { it.toList().sorted() }
            .groupBy { it }.map { it.value.size }
            .map { it.toLong()*(it-1)/2 }.sum()
})