object Main extends App {
  var n = io.StdIn.readInt
  var ss = Range(0,n).map(t=>io.StdIn.readLine.split("").sorted.mkString(""))
  val words = collection.mutable.Map[String,Int]()
  ss.foreach{s=>
    words += s -> (words.getOrElse(s,0)+1)
  }
  println(words.values.map{x=>x.toLong*(x.toLong-1L)/2}.sum)
}