import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val sl = Seq.fill(n)(sc.next)

  // 文字構成 ではなくそーとで
  val sortedStrings =
    sl.map(_.sorted)
      .zipWithIndex
      .groupBy(_._1)
      .mapValues(_.size)

  val res = sortedStrings
    .foldLeft(0L){ case (acc, m) =>
      val cnt = m._2
        acc + cnt * (cnt - 1) / 2
    }
  println(res)
}