import collections

import math

def combinations_count(n, r):

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(eval(input()))

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

B = collections.Counter(A)

num = 0

for i in set(A):

    if B[i] > 1:

        num += combinations_count(B[i], 2)

for i in A:

    print((num-B[i]+1))
import collections

N = int(eval(input()))

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

B = collections.Counter(A)

num = 0

for i in set(A):

    if B[i] > 1:

        num += B[i]*(B[i] - 1)//2

for i in A:

    print((num-B[i]+1))
import collections
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N = int(eval(input()))
A = list(map(int, input().split()))
B = collections.Counter(A)
num = 0
for i in set(A):
    if B[i] > 1:
        num += combinations_count(B[i], 2)
for i in A:
    print((num - B[i] + 1))

import collections

N = int(eval(input()))
A = list(map(int, input().split()))
B = collections.Counter(A)
num = 0
for i in set(A):
    if B[i] > 1:
        num += B[i] * (B[i] - 1) // 2
for i in A:
    print((num - B[i] + 1))

-import math - - -def combinations_count(n, r): -    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) - -        num += combinations_count(B[i], 2) +        num += B[i] * (B[i] - 1) // 2