import itertools

import math 

def C(n,r):

    if n-r < 0:

        return 0 

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



n = int(eval(input()))

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

d = {}

for i in a:

    d[i] = d.get(i, 0)+1



c = 0

cc = {}

for key, val in list(d.items()):

    temp = C(val,2)

    c += temp

    if cc.get(key) is None:

        cc[key] = temp - C(val-1,2)

for i in a:

    print((c - cc[i]))

import itertools

import math 

def C(n,r): return n*(n-1)//r



n = int(eval(input()))

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

d = {}

for i in a:

    d[i] = d.get(i, 0)+1



c = 0

cc = {}

for key, val in list(d.items()):

    temp = C(val,2)

    c += temp

    if cc.get(key) is None:

        cc[key] = temp - C(val-1,2)

for i in a:

    print((c - cc[i]))

import itertools
import math


def C(n, r):
    if n - r < 0:
        return 0
    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))


n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
    d[i] = d.get(i, 0) + 1
c = 0
cc = {}
for key, val in list(d.items()):
    temp = C(val, 2)
    c += temp
    if cc.get(key) is None:
        cc[key] = temp - C(val - 1, 2)
for i in a:
    print((c - cc[i]))

import itertools
import math


def C(n, r):
    return n * (n - 1) // r


n = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for i in a:
    d[i] = d.get(i, 0) + 1
c = 0
cc = {}
for key, val in list(d.items()):
    temp = C(val, 2)
    c += temp
    if cc.get(key) is None:
        cc[key] = temp - C(val - 1, 2)
for i in a:
    print((c - cc[i]))

-    if n - r < 0: -        return 0 -    return math.factorial(n) // (math.factorial(r) * math.factorial(n - r)) +    return n * (n - 1) // r