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 c = (1 to N).map(i => {
    A.filter(_ == i).sum
  })
  val x = c.map(ci => {
    ci * (ci - 1) / 2
  }).sum
  for (k <- 0 until N) {
    println(x - (c(A(k)) - 1))
  }
}
