

object Main extends App {

  import scala.collection.mutable.ArrayBuffer

  val n = scala.io.StdIn.readLine.toInt

  val ab = ArrayBuffer.empty[String]
  (1 to n).foreach { _ =>
    ab += scala.io.StdIn.readLine.sorted
  }

  var ans = 0
  (0 until n - 1).foreach { i =>
    (i + 1 until n).foreach { j =>
      if (ab(i) == ab(j)) {
        ans += 1
      }

    }

  }
  println(ans)
}