fun main(args: Array<String>) = abc159d()

fun abc159d() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toLong() }

    val groupBy = aList.groupBy { it }.mapValues { it.value.size.toLong() }

    val allMap = groupBy.map {
        var num = 0L
        for (i in 0 until it.value) num += i
        Pair(it.key, num)
    }.toMap()

    val allSum = allMap.map { it.value }.sum()

    val minusMap = groupBy.map {
        var num = 0L
        for (i in 0 until it.value - 1) num += i
        Pair(it.key, num)
    }.toMap()

    val answer = aList.map { allSum - allMap[it]!! + minusMap[it]!! }.joinToString(System.lineSeparator())

    println(answer)
}
