
fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val An = readLine()!!.split(" ").map(String::toInt)
    val duplicate_count_map: MutableMap<Int,Int> = mutableMapOf()
    An.forEach  {
        duplicate_count_map[it] = (duplicate_count_map[it]?: 0) + 1
    }

    val total_comb = duplicate_count_map.values.map {  
        it.toLong() * (it.toLong() - 1L )/ 2L
        }.fold(0L) {a, b -> a + b}

    for(i in 0 until N) {
        println(total_comb - (duplicate_count_map[An[i]]?.let{  (it - 1).toLong() }?: 0L))
    }
}