import scala.io.StdIn
import scala.annotation.tailrec

object Main extends App {

  val lines: Seq[String] = for {
    i <- 1 to StdIn.readInt()
  } yield StdIn.readLine()

  @tailrec
  def countAnagram(list: Seq[String], count: Int): Int = {
    list.headOption match {
      case None => 
        count
      case Some(value) =>
        countAnagram(list.tail, count + list.tail.count(_ == value))
    }
  }

  println(countAnagram(lines.map(_.sorted), 0))
}
