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

	var map = Map[Int, Int]()

	for(x<-a){
		if(map.contains(x)){
			map += x->(map(x) + 1)
		}else{
			map += x->1
		}
	}

	var map1 = Map[Int, Int]()
	var map2 = Map[Int, Int]()

	for(x<- map.keys){
		map1 += x->(combi(map(x)  , 2))
		map2 += x->(combi(map(x)-1, 2))
	}

	val map1_sum = map1.map{case (a, b) => b}.sum

	for(i<-0 until N){
		println(map1_sum - map1(a(i)) + map2(a(i)))
	}

	def combi(n: Int, r: Int): Int = {
		if(n < r) return 0
		else if(n == r) return 1
		else if(r == 0) return 1
		else if(r == 1) return n
		else return combi(n-1,r-1) + combi(n-1,r)
	}

}