object Main extends App {
  val n = scala.io.StdIn.readLine.toInt
  val s = (1 to n).map { _ =>
    scala.io.StdIn.readLine
  }

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

    }

  }
  println(ans)
}