import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextLong()
  val a = (1..n).map { sc.nextLong() }

  val map = mutableMapOf<Long, Long>()
  for (ai in a) {
    val tmp = map.getOrElse(ai) { 0 }
    map.put(ai, tmp+1)
  }

  var sum = 0L
  for (mi in map) {
    val value = mi.value
    val tmp = value * (value-1) / 2
    sum += tmp
  }

  val ans = mutableListOf<Long>()
  for (ai in a) {
    val value = map.getOrElse(ai) { 1 }
    val tmp = value * (value-1) / 2
    val tmpSum = sum - tmp

    val tmp2 = (value-1) * (value-2) / 2
    ans.add(tmpSum + tmp2)
  }


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