import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val sa = Array<CharArray>(n) { scanner.next().toCharArray() }

    val m = mutableMapOf<String, Long>()
    sa.forEach { ca ->
        ca.sort()
        val s = String(ca)
        val prev = m.get(s) ?: 0
        m.put(s, prev + 1)
    }

    var ret = 0L
    m.forEach { entry ->
        val v = entry.value

        ret += (v - 1) * v / 2
    }

    println(ret)
}