import java.util.*

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val a = readLine()!!.split(' ').map(String::toInt)
  val b = LongArray(n)
  a.forEach { b[it - 1]++ }
  val c = b.map { it * (it - 1) / 2 }
  val s = c.sum()
  a.forEach {
    val i = it - 1
    val t = (b[i] - 1) * (b[i] - 2) / 2
    println(s - c[i] + t)
  }
}
