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(i<-0 until N){
		c(i) = a.count(_ == i+1)
	}

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

	for(i<-0 until N){
		println(tp1 - c(a(i)-1) + 1)
	}
}