import java.util.*

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val map = HashMap<String, Long>()
    var ans = 0L
    repeat(n) {
        val line = readLine()!!.toCharArray().sorted().joinToString("")
        ans += map.getOrElse(line) { 0 }
        map[line] = map.getOrElse(line) { 0 } + 1
    }
    println(ans)
}