import collections



n = int(eval(input()))

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



c = collections.Counter(a)

li = list(c.values())



ans = 0



for i in li:

    ans += i*(i-1)//2



num = 0



for i in range(n):

    num = c[a[i]]

    if num == 1:

        print(ans)

    else:

        print((ans-(num-1)))
import collections

n = int(eval(input()))

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



c = collections.Counter(a)

ans = 0



for i in list(c.values()):

    ans += i * (i - 1) // 2



for i in a:

    num = c[i]

    print((ans - (num - 1)))
import collections

n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
li = list(c.values())
ans = 0
for i in li:
    ans += i * (i - 1) // 2
num = 0
for i in range(n):
    num = c[a[i]]
    if num == 1:
        print(ans)
    else:
        print((ans - (num - 1)))

import collections

n = int(eval(input()))
a = list(map(int, input().split()))
c = collections.Counter(a)
ans = 0
for i in list(c.values()):
    ans += i * (i - 1) // 2
for i in a:
    num = c[i]
    print((ans - (num - 1)))

-li = list(c.values()) -for i in li: +for i in list(c.values()): -num = 0 -for i in range(n): -    num = c[a[i]] -    if num == 1: -        print(ans) -    else: -        print((ans - (num - 1))) +for i in a: +    num = c[i] +    print((ans - (num - 1)))