object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val counts = Array.fill(N + 1)(0)
  val As = Array.fill(N)(in.nextInt)
  As.foreach(a => counts(a) += 1)
  val pairs = counts.map(c => c * (c - 1) / 2)
  val sum = pairs.sum
  val results = counts.map(c => sum - c * (c - 1) / 2 + (if (c > 0) (c - 1) * (c - 2) / 2 else 0))
  println(As.map(a => results(a)).mkString("\n"))
}