from collections import Counter

N = int(eval(input()))

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

d=Counter(A)

dic={}

total=0

for item in list(d.items()):

    counter=item[1]

    s1=(counter - 1)*(counter - 2)/2 #1個少ない

    s2=(counter)*(counter - 1)/2

    dic[item[0]]=int(s1 - s2)

    total+=int(s2)



for a in A:

    print((total + dic[a]))

import collections

def myAnswer(N:int,A:list)-> None:

   dic = collections.Counter(A)

   total =0

   for value in list(dic.values()):

      total += value * (value -1) //2

   for a in A:

      print((total - (dic[a]-1)))





def modelAnswer():

   return

def main():

   N = int(eval(input()))

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

   myAnswer(N,A[:])

if __name__ == '__main__':

   main()
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
d = Counter(A)
dic = {}
total = 0
for item in list(d.items()):
    counter = item[1]
    s1 = (counter - 1) * (counter - 2) / 2  # 1個少ない
    s2 = (counter) * (counter - 1) / 2
    dic[item[0]] = int(s1 - s2)
    total += int(s2)
for a in A:
    print((total + dic[a]))

import collections


def myAnswer(N: int, A: list) -> None:
    dic = collections.Counter(A)
    total = 0
    for value in list(dic.values()):
        total += value * (value - 1) // 2
    for a in A:
        print((total - (dic[a] - 1)))


def modelAnswer():
    return


def main():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    myAnswer(N, A[:])


if __name__ == "__main__":
    main()

-from collections import Counter +import collections -N = int(eval(input())) -A = list(map(int, input().split())) -d = Counter(A) -dic = {} -total = 0 -for item in list(d.items()): -    counter = item[1] -    s1 = (counter - 1) * (counter - 2) / 2  # 1個少ない -    s2 = (counter) * (counter - 1) / 2 -    dic[item[0]] = int(s1 - s2) -    total += int(s2) -for a in A: -    print((total + dic[a])) + +def myAnswer(N: int, A: list) -> None: +    dic = collections.Counter(A) +    total = 0 +    for value in list(dic.values()): +        total += value * (value - 1) // 2 +    for a in A: +        print((total - (dic[a] - 1))) + + +def modelAnswer(): +    return + + +def main(): +    N = int(eval(input())) +    A = list(map(int, input().split())) +    myAnswer(N, A[:]) + + +if __name__ == "__main__": +    main()