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

object Main extends App {
  val sc = new java.util.Scanner(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)
  }
  val patterns = 0.to(200000).scanLeft(0L)(_ + _)
  val sum = hashMap.values.map { count => patterns(count) }.sum
  val cache = mutable.HashMap[Int, Long]()
  0.until(N).foreach { i =>
    val key = array(i)
    val result = cache.getOrElseUpdate(key,
      sum - patterns(hashMap(key)) + patterns(hashMap(key) - 1))
    println(result)
  }
}
