import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val n = nextInt()
    val s = mutableMapOf<String, Int>()

    for (i in 1..n) {
        val letters = next().toList().sorted().joinToString("")
        s[letters] = s[letters]?.plus(1) ?: 1
    }

    println(s.map { if (it.value > 1) comb(it.value, 2) else 0 }.sum())
}

fun next() = readLine()!!
fun nextInt() = next().toInt()

fun perm(n: Int, k: Int): Long {
    require(n > 0 && k >= 0)
    return (n - k + 1 .. n).fold(1L) { acc, i -> acc * i }
}

fun comb(n: Int, k: Int): Long {
    require(n > 0 && k >= 0)
    val fact = (2..k).fold(1L) { acc, i -> acc * i }
    return perm(n, k) / fact
}

fun println(value : Any) {
    pw.println(value)
}