MOD = 10**9

fact_inv, inv = [0]*10**6, [0]*10**6



def init_nCk():

    fact_inv[0] = fact_inv[1] = 1

    inv[1] = 1

    for i in range(2,10**6):

        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD

        fact_inv[i] = fact_inv[i-1] * inv[i] % MOD



def nCk(n,k):

    if n<k:

        return 0

    if n<0 or k<0:

        return 0

    ans = 1

    for i in range(n, n-k+1 - 1, -1):

        ans *= i

        ans %= MOD

    return ans * fact_inv[k] % MOD

init_nCk()



from collections import Counter

N = int(eval(input()))

A = list(map(int, input().split()))

B = Counter(A)



ans = 0

for i in list(B.values()):

    ans += i*(i-1)//2



for a in A:

    k = B[a]

    print((ans - nCk(k-1,1)))
from collections import Counter

N = int(eval(input()))

A = list(map(int, input().split()))

B = Counter(A)



ans = 0

for i in list(B.values()):

    ans += i*(i-1)//2



for a in A:

    k = B[a]

    print((ans - (k-1)))
MOD = 10**9
fact_inv, inv = [0] * 10**6, [0] * 10**6


def init_nCk():
    fact_inv[0] = fact_inv[1] = 1
    inv[1] = 1
    for i in range(2, 10**6):
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD


def nCk(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    ans = 1
    for i in range(n, n - k + 1 - 1, -1):
        ans *= i
        ans %= MOD
    return ans * fact_inv[k] % MOD


init_nCk()
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
B = Counter(A)
ans = 0
for i in list(B.values()):
    ans += i * (i - 1) // 2
for a in A:
    k = B[a]
    print((ans - nCk(k - 1, 1)))

from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
B = Counter(A)
ans = 0
for i in list(B.values()):
    ans += i * (i - 1) // 2
for a in A:
    k = B[a]
    print((ans - (k - 1)))

-MOD = 10**9 -fact_inv, inv = [0] * 10**6, [0] * 10**6 - - -def init_nCk(): -    fact_inv[0] = fact_inv[1] = 1 -    inv[1] = 1 -    for i in range(2, 10**6): -        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD -        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD - - -def nCk(n, k): -    if n < k: -        return 0 -    if n < 0 or k < 0: -        return 0 -    ans = 1 -    for i in range(n, n - k + 1 - 1, -1): -        ans *= i -        ans %= MOD -    return ans * fact_inv[k] % MOD - - -init_nCk() -    print((ans - nCk(k - 1, 1))) +    print((ans - (k - 1)))