
import java.util.*

fun main(args: Array<String>) {
    val s = HashMap<Long, Long>()
    val n = getInt()
    val a = getLongs()
    a.forEach {
        s[it] = (s[it] ?: 0) + 1
    }

    val b = HashMap<Long, Long>()
    val c = HashMap<Long, Long>()
    s.forEach {
        val k = it.key
        val v = it.value
        b[k] = v * (v - 1) / 2
        c[k] = (v - 1) * (v - 2) / 2
    }
    val total = b.map { it.value }.sum()
    
    val out = ArrayList<Long>()

    a.forEach {
        out.add(total - b[it]!! + c[it]!!)
    }
    println(out.joinToString("\n"))
}

fun getInt() = readLine()!!.toInt()
fun getInts() = readLine()!!.split(" ").map { it.toInt() }
fun getLong() = readLine()!!.toLong()
fun getLongs() = readLine()!!.split(" ").map { it.toLong() }
