fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map { it.toInt() }
    val cnt = mutableMapOf<Int, Long>()
    a.map{cnt[it] = (cnt[it] ?: 0) + 1}
    val s = cnt.map { entry -> entry.value * (entry.value - 1) / 2 }.sum()
    (0 until n).map { println(s - cnt[a[it]]!! + 1) }
}