import java.util.*

fun main(args: Array<String>) {
        val k = Integer.parseInt(readNext())
        var hashMap = HashMap<String, Long>()
        var result: Long = 0
        for (i in 1..k) {
            val input    = readNext().split("")
            var str = ""
            input.sorted().map {
                str += it
            }
            hashMap.contains(str).let {

                var c: Long
                if (it) {
                    c = hashMap.get(str)!!.plus(1)
                    result += c
                    hashMap.put(str, hashMap.get(str)!!.plus(1))
                }else {
                    hashMap.put(str, 0)
                }
            }
        }
        println(result)
    }


    fun readNext(): String {
        return readLine()!!
    }
