import collections



n=int(eval(input()))

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



a=collections.Counter(A)



total=0

for v in list(a.values()):

    if v>1:

        c=(v*(v-1))//2

        total+=c



for i in A:

    ans=total-(a[i]*(a[i]-1))//2+((a[i]-1)*(a[i]-2))//2

    print(ans)
from collections import Counter



n = int(eval(input()))



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



A = Counter(a)



cnt = 0

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

    if i > 1:

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

    



for i in a:

    ans = 0

    before = (A[i]*(A[i]-1))//2

    after = ((A[i]-1)*(A[i]-2))//2

    

    ans = cnt - before + after

    print(ans)
import collections

n = int(eval(input()))
A = list(map(int, input().split()))
a = collections.Counter(A)
total = 0
for v in list(a.values()):
    if v > 1:
        c = (v * (v - 1)) // 2
        total += c
for i in A:
    ans = total - (a[i] * (a[i] - 1)) // 2 + ((a[i] - 1) * (a[i] - 2)) // 2
    print(ans)

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
A = Counter(a)
cnt = 0
for i in list(A.values()):
    if i > 1:
        cnt += i * (i - 1) // 2
for i in a:
    ans = 0
    before = (A[i] * (A[i] - 1)) // 2
    after = ((A[i] - 1) * (A[i] - 2)) // 2
    ans = cnt - before + after
    print(ans)

-import collections +from collections import Counter -A = list(map(int, input().split())) -a = collections.Counter(A) -total = 0 -for v in list(a.values()): -    if v > 1: -        c = (v * (v - 1)) // 2 -        total += c -for i in A: -    ans = total - (a[i] * (a[i] - 1)) // 2 + ((a[i] - 1) * (a[i] - 2)) // 2 +a = list(map(int, input().split())) +A = Counter(a) +cnt = 0 +for i in list(A.values()): +    if i > 1: +        cnt += i * (i - 1) // 2 +for i in a: +    ans = 0 +    before = (A[i] * (A[i] - 1)) // 2 +    after = ((A[i] - 1) * (A[i] - 2)) // 2 +    ans = cnt - before + after