object Main extends App {
    val lines = io.Source.fromInputStream(System.in).getLines()
    val n = lines.next().toInt
    val a: Array[Int] = lines.next().split(" ").map(_.toInt - 1)
    val cnt: Array[Int] = new Array(n)
    for(i <- 0 until n) { cnt(a(i)) += 1 }
    val total = cnt.map(x => choose2(x)).sum
    for(i <- 0 until n) {
        val c = cnt(a(i))
        println(total - (c - 1))
    }
    
    def choose2(n: Long): Long = n * (n - 1) / 2
}
