fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val AN = readLine()!!.split(" ").map(String::toInt)

    val map = mutableMapOf<Int, Long>()
    for (A in AN) {
        map[A] = map.getOrElse(A, { 0L }) + 1L
    }

    fun nC2(n: Long): Long {
        return n * (n - 1) / 2
    }

    var sum = 0L
    for ((k, v) in map) {
        sum += nC2(v)
    }

    for (A in AN) {
        val v = map[A]!!
        val before = nC2(v)
        val after = nC2(v - 1)
        println(sum + after - before)
    }
}
