import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer

object Main extends App {
  val sc = new FastScanner(System.in)
  val array = ArrayBuffer[Int]()
  val hashMap = mutable.HashMap[Int, Int]()
  val N: Int = sc.nextInt()
  1.to(N).foreach { _ =>
    val a = sc.nextInt()
    array.addOne(a)
    val count = hashMap.getOrElse(a, 0)
    hashMap.update(a, count + 1)
  }
  def pattern(count: Int): Int = count * (count - 1) / 2
  val sum = hashMap.values.map(pattern).sum
  val cache = mutable.HashMap[Int, Long]()
  0.until(N).foreach { i =>
    val key = array(i)
    val result = cache.getOrElseUpdate(key,
      sum - pattern(hashMap(key)) + pattern(hashMap(key) - 1))
    println(result)
  }

  class FastScanner(in: java.io.InputStream) {
    val buffer = new Array[Byte](1024)
    var length = 0
    var p = 0

    def hasNextByte: Boolean =
      if (p < length) true
      else {
        p = 0
        length = in.read(buffer)
        if (length == 0) false else true
      }

    def readByte: Int = if (hasNextByte) buffer({ p += 1; p - 1 }) else -1

    def isPrintable(n: Int): Boolean = 33 <= n && n <= 126

    def skip(): Unit = while (hasNextByte && !isPrintable(buffer(p))) p += 1

    def hasNext: Boolean = {
      skip()
      hasNextByte
    }

    def next(): String = {
      if (!hasNext) throw new NoSuchElementException
      val sb = new java.lang.StringBuilder
      var temp = readByte
      while (isPrintable(temp)) {
        sb.appendCodePoint(temp)
        temp = readByte
      }
      sb.toString
    }

    def nextInt(): Int = Math.toIntExact(nextLong())

    def nextInts(n: Int): Array[Int] = {
      val ar = new Array[Int](n)
      for (i <- 0 until n) ar(i) = nextInt()
      ar
    }

    def nextLong(): Int = {
      if (!hasNext) throw new NoSuchElementException
      var minus = false
      var temp = readByte
      if (temp == '-') {
        minus = true
        temp = readByte
      }
      if (temp < '0' || '9' < temp) throw new NumberFormatException
      var n = 0
      while (isPrintable(temp)) {
        if ('0' <= temp && temp <= '9') {
          n *= 10
          n += temp - '0'
        }
        temp = readByte
      }
      if (minus) -n else n
    }
  }

}
