import scala.io.StdIn._
object Main extends App {
  val n = readInt
  val ss = Array.fill(n)(readLine.sorted)
  def roundRobin(n: Int): Long = n.toLong * (n - 1) / 2
  println(ss.groupBy(identity).mapValues(s => roundRobin(s.size)).values.sum)
}