fun main(args: Array<String>) {
    val N = readInt()
    val A = readIntList()

//    val map = A
//        .groupingBy { it }
//        .eachCount()
//        .mapValues { (k,v)-> v*(v-1)/2 to (v-1)*(v-2)/2 }
    val tmpmap = mutableMapOf<Int, Int>()
    A.forEach{tmpmap[it] = (tmpmap[it]?:0) + 1 }
    val map = tmpmap
        .map { 
            it.key to (it.value.toLong()*(it.value-1)/2 to (it.value.toLong()-1)*(it.value-2)/2) }
        .toMap()
    val sum = map.values.map { it.first }.sum()

    repeat(N) {
        println(sum - map[A[it]]!!.first + map[A[it]]!!.second)
    }
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)