object ABC137C_GreenBin extends App {
  val sc = new java.util.Scanner(System.in)
  val wordCount: Int = sc.nextInt
  val wordsSorted = List.fill(wordCount)(sc.next).map(word => word.sorted)
  var wordsMap = collection.mutable.Map[String, Int]()
  var ans: Long = 0l
  wordsSorted.map(word => {
    ans += wordsMap.getOrElse(word, 0)
    wordsMap += (word -> (wordsMap.getOrElse(word, 0) + 1))
  })
  println(ans)
}
