object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    var ans = 0
    val buf = ArrayBuffer.empty[String]
    (0 until n).foreach(_ => {
      val s = sc.next.sorted
      ans += buf.count(_ == s)
      buf += s
    })
    sc.close()
    println(ans)
  }
}