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

	val c = new Array[Int](N)

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

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

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