import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val A = new Array[Int](N+1)
  for (i <- 1 to N)
    A(i) = in.next().toInt

  //
  val hash = Map[Int, Long]()
  for (i <- 1 to N) {
    val now = A(i)
    if (!hash.contains(now))
      hash += (now -> 1)
    else
      hash(now) += 1
  }

  var ans = 0L
  for ((_, v) <- hash) {
    ans += (v * (v-1)) / 2
  }

  for (i <- 1 to N) {
    val now = A(i)
    val v = hash(now)

    var hoge = ans - (v * (v-1)) / 2
    if (v-2 >= 0)
      hoge += ((v-1)*(v-2)) / 2
    pw.println(hoge)
  }

  pw.flush()
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.toList))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
