from collections import Counter

from sys import stdin



N = int(stdin.readline())

A = list(map(int, stdin.readline().split()))



cnt = Counter(A)



tmp = cnt.most_common()





def comb(n):

    return n * (n - 1) // 2





sumall = 0



for i in range(len(cnt)):

    sumall += comb(tmp[i][1])



for a in A:

    ans = sumall - (comb(cnt[a]) - comb(cnt[a] - 1))

    print(ans)

from collections import Counter

from sys import stdin



N = int(stdin.readline())

A = list(map(int, stdin.readline().split()))



cnt = Counter(A)





def comb(n):

    return n * (n - 1) // 2





sumall = 0



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

    sumall += comb(i)



for a in A:

    ans = sumall - (cnt[a] - 1)

    print(ans)

from collections import Counter
from sys import stdin

N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
cnt = Counter(A)
tmp = cnt.most_common()


def comb(n):
    return n * (n - 1) // 2


sumall = 0
for i in range(len(cnt)):
    sumall += comb(tmp[i][1])
for a in A:
    ans = sumall - (comb(cnt[a]) - comb(cnt[a] - 1))
    print(ans)

from collections import Counter
from sys import stdin

N = int(stdin.readline())
A = list(map(int, stdin.readline().split()))
cnt = Counter(A)


def comb(n):
    return n * (n - 1) // 2


sumall = 0
for i in list(cnt.values()):
    sumall += comb(i)
for a in A:
    ans = sumall - (cnt[a] - 1)
    print(ans)

-tmp = cnt.most_common() -for i in range(len(cnt)): -    sumall += comb(tmp[i][1]) +for i in list(cnt.values()): +    sumall += comb(i) -    ans = sumall - (comb(cnt[a]) - comb(cnt[a] - 1)) +    ans = sumall - (cnt[a] - 1)