import scala.io.StdIn.readLine
import scala.io.StdIn.readInt

object Main extends App {
  val num = readInt()
  val input = for (e <- 0 until num) yield readLine()

  val sorted = input.map(_.sorted).toList

  def count(ls: List[String]): Int = {
    def go(ls: List[String], n: Int): (List[String], Int) = ls match {
      case Nil => (Nil, n)
      case h :: Nil => (ls, n)
      case h :: tail => go(tail.filterNot(e => e == h), n + sorted.tail.count(_ == sorted.head))
    }
    go(sorted, 0)._2
  }

  val ans = count(sorted)

  println(ans)
}
