import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val a = (1..n).map { sc.next() }


  val array = Array(n) { Array(26) { 0 } }
  
  for ((i, ai) in a.withIndex()) {
    val arrayi = array[i]
    for (c in ai) {
      val tmp = c.toInt() - 'a'.toInt()
      arrayi[tmp]++
    }
  }

  val map = mutableMapOf<String, Long>()
  for (ai in array) {
    if (ai.toList().contains(10)) {
      continue
    }
    
    val key = ai.joinToString("")
    val tmp = map.getOrElse(key) { 0L }
    map.put(key, tmp+1)
  }

  val size = map.values.filter { it > 1 }.map { it * (it - 1) / 2 }.sum()

  println(size)


}