fun main(args: Array<String>) {
    solve(java.util.Scanner(System.`in`))
}

fun <A> countList(a: List<A>): Map<A, Long> {
    val result = mutableMapOf<A, Long>()
    a.forEach {
        result[it] = (result[it] ?: 0L) + 1L
    }
    return result
}

fun solve(sc: java.util.Scanner) {
    val N = sc.nextInt()
    val A = Array(N) { sc.nextInt() }
    val C = countList(A.toList())

    val total = C.map { a -> a.value * (a.value - 1) / 2 }.sum()
    A.forEach { a ->
        println(total - (C[a]!!.toInt() - 1))
    }
}
