from collections import Counter

N = int(eval(input()))

B = [int(x) for x in input().split()]

A=Counter(B)

V, C = list(zip(*A.most_common()))

count=0

for x in C:

  if x==0:

    break

  count+=x*(x-1)/2

for x in B:

  ans=count-A[x]+1

  print((int(ans)))

from collections import Counter

n=eval(input())

*l,=list(map(int,input().split()))

A=Counter(l)

c=0

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

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

for j in l:

  print((c-A[j]+1))

from collections import Counter

N = int(eval(input()))
B = [int(x) for x in input().split()]
A = Counter(B)
V, C = list(zip(*A.most_common()))
count = 0
for x in C:
    if x == 0:
        break
    count += x * (x - 1) / 2
for x in B:
    ans = count - A[x] + 1
    print((int(ans)))

from collections import Counter

n = eval(input())
(*l,) = list(map(int, input().split()))
A = Counter(l)
c = 0
for i in list(A.values()):
    c += i * (i - 1) // 2
for j in l:
    print((c - A[j] + 1))

-N = int(eval(input())) -B = [int(x) for x in input().split()] -A = Counter(B) -V, C = list(zip(*A.most_common())) -count = 0 -for x in C: -    if x == 0: -        break -    count += x * (x - 1) / 2 -for x in B: -    ans = count - A[x] + 1 -    print((int(ans))) +n = eval(input()) +(*l,) = list(map(int, input().split())) +A = Counter(l) +c = 0 +for i in list(A.values()): +    c += i * (i - 1) // 2 +for j in l: +    print((c - A[j] + 1))