fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val ss = (1..n).map {
    readLine()!!
      .toList()
      .sorted()
      .joinToString(separator="")
  }.sorted()
  val count : MutableMap<String, Int> = java.util.HashMap<String, Int>()
  for (str in ss) {
    val k = count.getOrPut(str, { 0 })
    count[str] = k + 1
  }
  val ans = count.map{
    val t = it.value.toLong()
    t * (t - 1) / 2
  }.sum()
  println(ans)
}
