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

object Main extends App {

  val n = readInt
  val aList = readLine.split(" ").map(_.toInt)

  val numToCount = mutable.Map.empty[Int, Int]
  aList.foreach { n =>
    val existing = numToCount.getOrElse(n, 0)
    numToCount.put(n, existing+1)
  }

  val all = numToCount.map { case (_, count) => {
    count.toLong * (count - 1) / 2
  }}.sum

  val ans = aList.map { n =>
    val minus = numToCount(n) - 1
    all - minus
  }

  println(ans.mkString("\n"))
}

