from collections import Counter



N = int(eval(input()))

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

C = Counter(al)

# print(C)

# print(C.values())

ans = 0

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

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



for a in al:

    k = C[a]

    print((int(ans - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))

import math

from collections import Counter

import itertools

n = int(eval(input()))

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

C_al = Counter(al)



all = 0

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

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



for i in al:

    k = C_al[i]

    print((int(all - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))

    





from collections import Counter

N = int(eval(input()))
al = list(map(int, input().split()))
C = Counter(al)
# print(C)
# print(C.values())
ans = 0
for i in list(C.values()):
    ans += i * (i - 1) / 2
for a in al:
    k = C[a]
    print((int(ans - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))

import math
from collections import Counter
import itertools

n = int(eval(input()))
al = list(map(int, input().split()))
C_al = Counter(al)
all = 0
for i in list(C_al.values()):
    all += i * (i - 1) / 2
for i in al:
    k = C_al[i]
    print((int(all - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))

+import math +import itertools -N = int(eval(input())) +n = int(eval(input())) -C = Counter(al) -# print(C) -# print(C.values()) -ans = 0 -for i in list(C.values()): -    ans += i * (i - 1) / 2 -for a in al: -    k = C[a] -    print((int(ans - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2))) +C_al = Counter(al) +all = 0 +for i in list(C_al.values()): +    all += i * (i - 1) / 2 +for i in al: +    k = C_al[i] +    print((int(all - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)))