#!/usr/bin/env python3

from collections import Counter



from scipy.special import comb



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

c = Counter(a)

s = sum(comb(i, 2, exact=True) for i in list(c.values()))

for i in a:

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

#!/usr/bin/env python3

from collections import Counter



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

c = Counter(a)

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

for i in a:

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

#!/usr/bin/env python3
from collections import Counter
from scipy.special import comb

_, *a = list(map(int, open(0).read().split()))
c = Counter(a)
s = sum(comb(i, 2, exact=True) for i in list(c.values()))
for i in a:
    print((s - c[i] + 1))

#!/usr/bin/env python3
from collections import Counter

_, *a = list(map(int, open(0).read().split()))
c = Counter(a)
s = sum(i * (i - 1) // 2 for i in list(c.values()))
for i in a:
    print((s - c[i] + 1))

-from scipy.special import comb -s = sum(comb(i, 2, exact=True) for i in list(c.values())) +s = sum(i * (i - 1) // 2 for i in list(c.values()))