import collections

n = int(eval(input()))

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

cnt = 0

c = collections.Counter(a)

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

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

for j in range(n):

    print((cnt - c[a[j]] + 1))
from collections import Counter

n = int(eval(input()))

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



c = Counter(a)

#print(c)



s = 0

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

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



for i in range(n):

    print((s - c[a[i]] + 1))
import collections

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

from collections import Counter

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

-import collections +from collections import Counter -cnt = 0 -c = collections.Counter(a) +c = Counter(a) +# print(c) +s = 0 -    cnt += i * (i - 1) // 2 -for j in range(n): -    print((cnt - c[a[j]] + 1)) +    s += i * (i - 1) // 2 +for i in range(n): +    print((s - c[a[i]] + 1))