import java.lang.StringBuilder

fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val list = readLine()!!.split(" ").map { it.toInt() }
    val cnt = mutableMapOf<Int, Long>()
    for(i in list) {
        cnt[i] = (cnt[i]?:0L) + 1L
    }
    val total = cnt.map { (it.value * (it.value - 1))/2 }.sum()
    val ans = StringBuilder()
    for(i in list) {
        val subTotal = (cnt[i]!! * (cnt[i]!! - 1)) / 2
        val tmp = ((cnt[i]!! - 1) * (cnt[i]!! - 2)) / 2
        ans.appendln(total - subTotal + tmp)
    }
    print(ans.toString())
}
