fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toInt).toTypedArray()
    val map = A.groupBy { it }.map { Pair(it.key, it.value.size) }.filter { it.second > 1 }.associate { it }
    val total = map.map { combination(it.value, 2) }.sum()
    for (k in A.indices) {
        val cnt = map[A[k]]
        if (cnt != null) {
            println(total - combination(cnt, 2) + combination(cnt - 1, 2))
        } else {
            println(total)
        }
    }
}

fun combination(n: Int, k: Int): Long {
    if (n < k) return 0
    var a = 1L
    var b = 1L
    val min = Math.min(n - k, k)
    for (i in n - min + 1..n) {
        a *= i
    }
    for (i in 1..min) {
        b *= i
    }
    return a / b
}