object Main extends App {
	val N = scala.io.StdIn.readInt
	val a = scala.io.StdIn.readLine.split(" ").map(_.toLong)

	val c = new Array[Long](N)

	for(x<-a){
		c(x.toInt-1) += 1L
	}

	val sum = c.map(z => z*(z-1L)/2L).sum

	for(x <- a){
		println(sum - c(x.toInt-1) + 1L)
	}
}