fun main(args: Array<String>) {
    val N = readInputLine().toInt()

    val AArr = readInputLine().split(" ").map { it.toInt() }.toIntArray()
    val cnt = mutableMapOf<Int, Long>()

    for (A in AArr) {
        cnt[A] = (cnt[A] ?: 0L) + 1L
    }

    var cntSum = 0L
    for ((k, v) in cnt) {
        cntSum += v * (v - 1L) / 2L
    }

    repeat(N) {
        println(cntSum - (cnt[AArr[it]]!! - 1L))
    }
}

fun readInputLine(): String {
    return readLine()!!
}
