from collections import Counter



N = int(eval(input()))

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





def comb(x):

    if x == 0:

        return 0

    if x == 1:

        return 0

    return x * (x - 1) // 2





d = Counter(A)

# print(d)

k = list(d.keys())



# print(k)

total = 0



for kk in k:

    total += comb(d[kk])



# print(total)



for a in A:

    res = total

    res -= comb(d[a])

    res += comb(d[a] - 1)

    print(res)
from collections import Counter



N = int(eval(input()))

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



d = Counter(A)

k = list(d.keys())



# print(d, k)





def nC2(x):

    return x * (x - 1) // 2





total = 0

for kk in k:

    total += nC2(d[kk])



# print(total)



for a in A:

    res = total

    res -= d[a] - 1

    print(res)

from collections import Counter

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


def comb(x):
    if x == 0:
        return 0
    if x == 1:
        return 0
    return x * (x - 1) // 2


d = Counter(A)
# print(d)
k = list(d.keys())
# print(k)
total = 0
for kk in k:
    total += comb(d[kk])
# print(total)
for a in A:
    res = total
    res -= comb(d[a])
    res += comb(d[a] - 1)
    print(res)

from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
d = Counter(A)
k = list(d.keys())
# print(d, k)
def nC2(x):
    return x * (x - 1) // 2


total = 0
for kk in k:
    total += nC2(d[kk])
# print(total)
for a in A:
    res = total
    res -= d[a] - 1
    print(res)

- - -def comb(x): -    if x == 0: -        return 0 -    if x == 1: -        return 0 +d = Counter(A) +k = list(d.keys()) +# print(d, k) +def nC2(x): -d = Counter(A) -# print(d) -k = list(d.keys()) -# print(k) -    total += comb(d[kk]) +    total += nC2(d[kk]) -    res -= comb(d[a]) -    res += comb(d[a] - 1) +    res -= d[a] - 1