fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

fun String.sort() = toCharArray().sortedArray().joinToString("")

fun main(args: Array<String>) {
    val N = readInt()
    val s = Array(N) { readString() }.run {
        map { it.sort() }.toTypedArray()
    }

    var res = 0L
    val sMap = mutableMapOf<String, Int>()
    for (i in 0 until s.count()) {
        val cnt = sMap[s[i]]
        if (cnt != null) {
            res += cnt
            sMap[s[i]] = cnt + 1
        } else {
            sMap[s[i]] = 1
        }
    }

    println(res)
}