n = int(eval(input()))

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



nums = [0]*(n+1)

for i in a: nums[i] += 1



t = 0

for i in nums: t += i*(i-1)//2



for i in a: print((t+1-nums[i]))
from collections import Counter

n = int(eval(input()))

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



count = Counter(a)

numSum = 0

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

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



for i in a:

  print((numSum - (count[i]-1)))
n = int(eval(input()))
a = list(map(int, input().split()))
nums = [0] * (n + 1)
for i in a:
    nums[i] += 1
t = 0
for i in nums:
    t += i * (i - 1) // 2
for i in a:
    print((t + 1 - nums[i]))

from collections import Counter

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

+from collections import Counter + -nums = [0] * (n + 1) +count = Counter(a) +numSum = 0 +for i in list(count.values()): +    numSum += i * (i - 1) // 2 -    nums[i] += 1 -t = 0 -for i in nums: -    t += i * (i - 1) // 2 -for i in a: -    print((t + 1 - nums[i])) +    print((numSum - (count[i] - 1)))