fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toInt() }

    val nums = mutableMapOf<Int, Int>()
    val comb = mutableMapOf<Int, Long>()

    aa.forEachIndexed { idx, a ->
        val tmp = nums[a] ?: 0
        if (tmp == 0) {
            nums[a] = 1
            comb[a] = 0
            return@forEachIndexed
        }

        if (tmp == 1) {
            nums[a] = 2
            comb[a] = 1
            return@forEachIndexed
        }

        comb[a] = comb[a]!! + nums[a]!!
        nums[a] = nums[a]!! + 1
    }

    var combSum = 0L
    comb.entries.forEach {
        combSum += it.value
    }

    aa.forEach {
        println(combSum - (nums[it]!!-1))
    }
}