import scala.io.StdIn
object Main extends App {
  val N = StdIn.readLine().toInt
  val s = (for (i <- 1 to N; s = StdIn.readLine()) yield s.toList.sorted.mkString).toList
  val answer =
    for {
      i <- 0 until s.length - 1
      j <- i+1 until s.length
      if (s(i) == s(j))
    } yield s(i)
  println(answer.length)
}
