import scala.io.StdIn
object Main extends App {
  val N = StdIn.readLine().toInt
  var m = scala.collection.mutable.HashMap.empty[String, Long]

  (1 to N).foreach {
    i =>
      val s = StdIn.readLine().toString.sorted
      if (m.contains(s)) {
        m(s) = m(s) + 1L
      } else {
        m.update(s, 1L)
      }
  }
  println(m.values.map(n => n * (n-1L) / 2L).sum)
}
