fun main(args: Array<String>) {
    fun ncr2(n: Long): Long {
        return ((n * n) - n) / 2L
    }
    val n = readLine()?.toInt() ?: return
    val aList = readLine()?.split(" ")?.map(String::toInt) ?: return

    val map = hashMapOf<Int, Long>()
    aList.forEach { a ->
        map[a] = map[a]?.let { it + 1L } ?: 1L
    }
    var sum = 0L
    map.values.forEach {
        sum += ncr2(it)
    }

    for (i in aList.indices) {
        val decrementValue = aList[i]
        val size = map[decrementValue] ?: 0L
        if (size > 1L) {
            println(sum - (ncr2(size) - ncr2(size - 1)))
        } else {
            println(sum)
        }
    }
}
