# from collections import deque

from collections import Counter

from scipy.misc import comb

# from copy import deepcopy



n = int(eval(input()))

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

C = Counter(a)

S = 0

for key in C:

    S += comb(C[key], 2, exact=True)



for k in range(n):

    A = a[k]

    print((S - C[A] + 1))
# from collections import deque

from collections import Counter

# from scipy.misc import comb

# from copy import deepcopy



n = int(eval(input()))

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

C = Counter(a)

S = 0

"""

for key in C:

    S += comb(C[key], 2, exact=True)

"""

for i in list(C.keys()):

    S += C[i]*(C[i]-1)//2



for k in range(n):

    A = a[k]

    print((S - C[A] + 1))
# from collections import deque
from collections import Counter
from scipy.misc import comb

# from copy import deepcopy
n = int(eval(input()))
a = list(map(int, input().split()))
C = Counter(a)
S = 0
for key in C:
    S += comb(C[key], 2, exact=True)
for k in range(n):
    A = a[k]
    print((S - C[A] + 1))

# from collections import deque
from collections import Counter

# from scipy.misc import comb
# from copy import deepcopy
n = int(eval(input()))
a = list(map(int, input().split()))
C = Counter(a)
S = 0
"""
for key in C:
    S += comb(C[key], 2, exact=True)
"""
for i in list(C.keys()):
    S += C[i] * (C[i] - 1) // 2
for k in range(n):
    A = a[k]
    print((S - C[A] + 1))

-from scipy.misc import comb +# from scipy.misc import comb +""" +""" +for i in list(C.keys()): +    S += C[i] * (C[i] - 1) // 2