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