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[Long](n + 1)
    val dcns = Array.ofDim[Long](n + 1)
    for (i <- as.indices) {
      val c = map(i)
      cns(i) = if (c > 1) {
        1L * c * (c - 1) / 2
      } else {
        0
      }
      dcns(i) = if (c > 2) {
        1L * (c - 1) * (c - 2) / 2
      } else {
        0
      }
    }

    val sumOfCns = cns.foldLeft(BigInt(0)) {
      case (acc, cn) => acc + cn
    }

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

    out.flush()
  }
}
