import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val arr = IntArray(n){scn.nextInt()}
	val map = mutableMapOf<Int, Int>()
	arr.forEach { map[it] = map.getOrElse(it){0} + 1 }
	var sum = 0L
	map.forEach {
		val v = it.value.toLong()
		sum += v*(v-1)/2
	}
	arr.forEach {
		println(sum-(map[it] ?:0)+1)
	}
}