import math

import collections



def cmb(n, r):

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

    

N = int(eval(input()))

M = input().split()



total = 0

count = collections.Counter(M)



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

    if i >= 2:

        total += cmb(i, 2)

    

for j in M:

    print((total - (count[j]-1)))
import collections

N= int(eval(input()))

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

b = collections.Counter(A)

C=0

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

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



for i in range(N):

    print((int(C-(b[A[i]])+1)))
import math
import collections


def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N = int(eval(input()))
M = input().split()
total = 0
count = collections.Counter(M)
for i in list(count.values()):
    if i >= 2:
        total += cmb(i, 2)
for j in M:
    print((total - (count[j] - 1)))

import collections

N = int(eval(input()))
A = list(map(int, input().split()))
b = collections.Counter(A)
C = 0
for i in list(b.values()):
    C += i * (i - 1) / 2
for i in range(N):
    print((int(C - (b[A[i]]) + 1)))

-import math - -def cmb(n, r): -    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) - - -M = input().split() -total = 0 -count = collections.Counter(M) -for i in list(count.values()): -    if i >= 2: -        total += cmb(i, 2) -for j in M: -    print((total - (count[j] - 1))) +A = list(map(int, input().split())) +b = collections.Counter(A) +C = 0 +for i in list(b.values()): +    C += i * (i - 1) / 2 +for i in range(N): +    print((int(C - (b[A[i]]) + 1)))