import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N = sc.nextInt
  val A = List.fill(N)(sc.nextInt)

  val xs = A.groupBy(identity)
  val y = xs.map(x => {
    val a = x._2.size
    a * (a - 1) / 2
  }).sum
  for (i <- 0 until N) {
    println(y - (xs(A(i)).size - 1))
  }
}
