import scala.collection.mutable

object Main extends App {
    val lines = io.Source.fromInputStream(System.in).getLines()
    val n = lines.next().toInt
    val as: Seq[Int] = lines.next().split(" ").map(_.toInt).toSeq

    // map of each kind of C[A_i, 2]
    val counts: mutable.Map[Int, Int] = mutable.HashMap.empty[Int, Int]
    for (a <- as) {
        counts.get(a) match {
            case Some(x) => counts.put(a, x + 1)
            case None => counts.put(a, 1)
        }
    }
    val sumCombinations = counts.values.map(n => n * (n - 1) / 2).sum

    for (a <- as) {
        val count = counts(a)
        println(sumCombinations - (count - 1))
    }
}
