import java.util.*

fun main(args: Array<String>) = ABC159D.main()

object ABC159D {
    fun readInt() = readLine()!!.toInt()
    fun readInts() = readLine()!!.split(" ").map { it.toInt() }

    val N: Int
    val A: List<Int>

    // a -> aがかかれたボールの個数
    val numGroups: Map<Int, Int>

    // a -> aがかかれたボールを選ぶ組み合わせ
    val combinations: Map<Int, Long>
    val combinationSum: Long

    init {
        N = readInt()
        A = readInts()
        numGroups = A.groupBy { it }.mapValues { it.value.size }
        combinations = numGroups.mapValues {
            val n = it.value.toLong()
            n * (n - 1) / 2
        }
        combinationSum = combinations.values.sum()
    }

    fun solve(k: Int): Long {
        // 除いたボールに書かれてる数
        val removedA = A[k-1]
        val n = numGroups[removedA]!!.toLong() -1

        return combinationSum - combinations[removedA]!! + (n * (n - 1) / 2)
    }

    fun main() {
        val results = (1..N).map { k ->
            solve(k)
        }
        println(results.joinToString("\n"))
    }
}