from collections import Counter



eval(input())

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

c = Counter(a)

s = sum(k * (k - 1) // 2  for k in list(c.values()))

for x in a:

  print((s - c[x] + 1))

from collections import Counter



eval(input())

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

c = Counter(a)

s = sum(k * (k - 1) // 2  for k in list(c.values())) + 1

for x in a:

  print((s - c[x]))

from collections import Counter

eval(input())
a = list(map(int, input().split()))
c = Counter(a)
s = sum(k * (k - 1) // 2 for k in list(c.values()))
for x in a:
    print((s - c[x] + 1))

from collections import Counter

eval(input())
a = list(map(int, input().split()))
c = Counter(a)
s = sum(k * (k - 1) // 2 for k in list(c.values())) + 1
for x in a:
    print((s - c[x]))

-s = sum(k * (k - 1) // 2 for k in list(c.values())) +s = sum(k * (k - 1) // 2 for k in list(c.values())) + 1 -    print((s - c[x] + 1)) +    print((s - c[x]))