N=int(eval(input()))

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



from collections import Counter

C=Counter(A)

ANS=0

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

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



for a in A:

    k=C[a]



    print((ANS-(k*(k-1)//2)+((k-1)*(k-2)//2)))

import collections





def resolve():

    N = int(eval(input()))

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



    counter = collections.Counter(A)

    ans = 0



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

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



    for a in A:

        count = counter[a]

        print((ans - (count * (count - 1) // 2) +

              ((count - 1) * (count - 2) // 2)))





resolve()
N = int(eval(input()))
A = list(map(int, input().split()))
from collections import Counter

C = Counter(A)
ANS = 0
for i in list(C.values()):
    ANS += i * (i - 1) // 2
for a in A:
    k = C[a]
    print((ANS - (k * (k - 1) // 2) + ((k - 1) * (k - 2) // 2)))

import collections


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


resolve()

-N = int(eval(input())) -A = list(map(int, input().split())) -from collections import Counter +import collections -C = Counter(A) -ANS = 0 -for i in list(C.values()): -    ANS += i * (i - 1) // 2 -for a in A: -    k = C[a] -    print((ANS - (k * (k - 1) // 2) + ((k - 1) * (k - 2) // 2))) + +def resolve(): +    N = int(eval(input())) +    A = list(map(int, input().split())) +    counter = collections.Counter(A) +    ans = 0 +    for i in list(counter.values()): +        ans += i * (i - 1) // 2 +    for a in A: +        count = counter[a] +        print((ans - (count * (count - 1) // 2) + ((count - 1) * (count - 2) // 2))) + + +resolve()