import scala.io.StdIn._
import scala.collection.mutable

object Main extends App {

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

  val map = mutable.Map[String, Int]().withDefaultValue(0)
  var ans = 0L
  lines.foreach { l =>
    ans += map(l)
    map(l) += 1
  }

  println(ans)
}
