import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = in.readLine().toInt
    val as = in.readLine().split("\\s+").map(_.toInt)

    val map = Array.ofDim[Int](n + 1)
    for (a <- as) {
      map(a) += 1
    }

    val cns = Array.ofDim[Int](n + 1)
    val dcns = Array.ofDim[Int](n + 1)
    for (i <- as.indices) {
      val c = map(i)
      cns(i) = if (c > 1) {
        map(i) * (map(i) - 1) / 2
      } else {
        0
      }
      dcns(i) = if (c > 2) {
        (map(i) - 1) * (map(i) - 2) / 2
      } else {
        0
      }
    }

    val sumOfCns = cns.sum

    for (a <- as) {
      out.println(sumOfCns - cns(a) + dcns(a))
    }

    out.flush()
  }
}
