fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val strArray = Array(n) {
        readLine()!!.toCharArray().sortedArray().let { String(it) }
    }
    strArray.sort()
    var ans = 0L
    val list = Array<Long>(100010) { 0 }
    for (i in 2..100005) {
        list[i] = list[i - 1] + i - 1
    }
    var s = 0
    var str: String
    while (s < n) {
        str = strArray[s]
        var count = 0
        while (s < n && strArray[s] == str) {
            s++
            count++
        }
        ans += list[count]
    }
    println(ans)
}