import java.util.Scanner;

fun main (args : Array<String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    val N = input.nextInt()
	val A = IntArray(N)
	val count = LongArray(200_000 + 1)
	
	for (i in A.indices) {
	  A[i] = input.nextInt()
	  ++count[A[i]]
	}
	
	var ways = 0L
	for (i in count.indices) {
	  if (count[i] > 0) {
	    ways += (count[i] * (count[i] - 1)) / 2
	  }
	}
	
	for (i in A.indices) {
	  var k = ways -  (count[A[i]] * (count[A[i]] - 1)) / 2 + ((count[A[i]] - 1) * (count[A[i]] - 2)) / 2
      println(k)
	}
  }
}