N=int(eval(input()))

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



B={}

for i in range(N):

    if A[i] not in B:

        B[A[i]]=1

    else:

        B[A[i]]+=1



total=0



for k,v in list(B.items()):

    total+=v*(v-1)//2



for i in range(N):

    ans=total

    ans-=B[A[i]]-1

    print(ans)

N=int(eval(input()))

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

from collections import Counter



B=Counter(A)



total=0



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

    total+=v*(v-1)//2



for i in range(N):

    ans=total

    ans-=B[A[i]]-1

    print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
B = {}
for i in range(N):
    if A[i] not in B:
        B[A[i]] = 1
    else:
        B[A[i]] += 1
total = 0
for k, v in list(B.items()):
    total += v * (v - 1) // 2
for i in range(N):
    ans = total
    ans -= B[A[i]] - 1
    print(ans)

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

B = Counter(A)
total = 0
for v in list(B.values()):
    total += v * (v - 1) // 2
for i in range(N):
    ans = total
    ans -= B[A[i]] - 1
    print(ans)

-B = {} -for i in range(N): -    if A[i] not in B: -        B[A[i]] = 1 -    else: -        B[A[i]] += 1 +from collections import Counter + +B = Counter(A) -for k, v in list(B.items()): +for v in list(B.values()):