fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map(String::toInt)
    val C = IntArray(N + 1)
    var total = 0L
    for (a in A) {
        total += C[a]
        C[a]++
    }
    for (k in A.indices) {
        println(total - (C[A[k]] - 1)) // - nC2 + (n-1)C2 = -(n-1)
    }
}