n,*a,=list(map(int,open(0).read().split()))

d={}

for i in a:

    d[i]=d.get(i,0)+1

b=0

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

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

for i in a:

    print((b-d[i]+1))
n,*a=list(map(int,open(0).read().split()))

d={}

for i in a:

  d[i]=d.get(i,0)+1

ans=sum([i*(i-1)//2 for i in list(d.values())])

for i in a:

    print((ans+1-d[i]))
(
    n,
    *a,
) = list(map(int, open(0).read().split()))
d = {}
for i in a:
    d[i] = d.get(i, 0) + 1
b = 0
for i in list(d.values()):
    b += i * (i - 1) // 2
for i in a:
    print((b - d[i] + 1))

n, *a = list(map(int, open(0).read().split()))
d = {}
for i in a:
    d[i] = d.get(i, 0) + 1
ans = sum([i * (i - 1) // 2 for i in list(d.values())])
for i in a:
    print((ans + 1 - d[i]))

-( -    n, -    *a, -) = list(map(int, open(0).read().split())) +n, *a = list(map(int, open(0).read().split())) -b = 0 -for i in list(d.values()): -    b += i * (i - 1) // 2 +ans = sum([i * (i - 1) // 2 for i in list(d.values())]) -    print((b - d[i] + 1)) +    print((ans + 1 - d[i]))