object Main extends App {
  val sc = new java.util.Scanner(System.in)
  println {
    Seq.fill(sc.nextInt())(sc.next())
      .map(_.sorted)
      .groupBy(identity)
      .map(_._2.size.toLong)
      .foldLeft(0L)((acc, i) => acc + i * (i - 1L) / 2L)
  }
}