import java.lang.IllegalArgumentException
import java.math.BigInteger
import java.util.*

fun main(args: Array<String>) {

    var sc = Scanner(System.`in`)
    var n = sc.nextInt()

    var a = IntArray(n)
    for (i in 0 until n) {
        a[i] = sc.nextInt()
    }
    var map = mutableMapOf<Int, Long>()

    (0 until n).forEach {
        var t = a[it]
        map[t] = if (map.containsKey(t)) map[t]!! + 1 else 1
    }

    var ans = BigInteger.ZERO
    for ((i, s) in map) {
        ans = ans.plus(BigInteger.valueOf(s * (s - 1) / 2))
    }

    a.forEach {
        val s = map[it] ?: throw IllegalArgumentException(n.toString())
        println(ans.plus(BigInteger.valueOf((s - 1) * (s - 2) / 2 - s * (s - 1) / 2)))
    }

}

