from operator import mul

from functools import reduce



N = int(eval(input()))

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



def cmb(n, r):

    if n < r:  return 0

    r = min(n - r, r)

    if r == 0: return 1

    over = reduce(mul, list(range(n, n - r, -1)))

    under = reduce(mul, list(range(1, r + 1)))

    return over // under



dic = {}

ma = max(A)

for i in range(N):

    if A[i] in dic:

        dic[A[i]] += 1

    else:

        dic[A[i]] = 1

        

c = [0 for _ in range(ma + 1)]

for i in dic:

    c[i] = cmb(dic[i], 2)

sum_ = sum(c)



for i in range(N):

    ans = sum_ - c[A[i]] + cmb(dic[A[i]] - 1, 2)

    print(ans)
from operator import mul

from functools import reduce

 

N = int(eval(input()))

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

 

def cmb(n, r):

    if n < r:  return 0

    r = min(n - r, r)

    if r == 0: return 1

    over = reduce(mul, list(range(n, n - r, -1)))

    under = reduce(mul, list(range(1, r + 1)))

    return over // under



dic = {}

for i in range(N):

    if A[i] in dic:  dic[A[i]] += 1

    else:  dic[A[i]] = 1

        

sum_ = 0

for i in dic: sum_ += cmb(dic[i], 2)



    

for i in range(N):

    ans = sum_ - (dic[A[i]] - 1)

    print(ans)
from operator import mul
from functools import reduce

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


def cmb(n, r):
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, list(range(n, n - r, -1)))
    under = reduce(mul, list(range(1, r + 1)))
    return over // under


dic = {}
ma = max(A)
for i in range(N):
    if A[i] in dic:
        dic[A[i]] += 1
    else:
        dic[A[i]] = 1
c = [0 for _ in range(ma + 1)]
for i in dic:
    c[i] = cmb(dic[i], 2)
sum_ = sum(c)
for i in range(N):
    ans = sum_ - c[A[i]] + cmb(dic[A[i]] - 1, 2)
    print(ans)

from operator import mul
from functools import reduce

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


def cmb(n, r):
    if n < r:
        return 0
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, list(range(n, n - r, -1)))
    under = reduce(mul, list(range(1, r + 1)))
    return over // under


dic = {}
for i in range(N):
    if A[i] in dic:
        dic[A[i]] += 1
    else:
        dic[A[i]] = 1
sum_ = 0
for i in dic:
    sum_ += cmb(dic[i], 2)
for i in range(N):
    ans = sum_ - (dic[A[i]] - 1)
    print(ans)

-ma = max(A) -c = [0 for _ in range(ma + 1)] +sum_ = 0 -    c[i] = cmb(dic[i], 2) -sum_ = sum(c) +    sum_ += cmb(dic[i], 2) -    ans = sum_ - c[A[i]] + cmb(dic[A[i]] - 1, 2) +    ans = sum_ - (dic[A[i]] - 1)