import sys

myin = [x.rstrip() for x in sys.stdin.readlines()]



n = int(myin[0])

a = [int(x) for x in myin[1].split()]



cnt = [0] * (n+1)

for v in a:

    cnt[v] += 1



tmp = 0

for c in cnt:

    tmp += c * (c-1) // 2

for v in a:

    print((tmp - cnt[v] + 1))
import sys

myin = sys.stdin.readlines()



n = int(myin[0])

a = [int(x) for x in myin[1].split()]



cnt = [0] * (n+1)

for v in a:

    cnt[v] += 1



tmp = 0

for c in cnt:

    tmp += c * (c-1) // 2

for v in a:

    print((tmp - cnt[v] + 1))
import sys

myin = [x.rstrip() for x in sys.stdin.readlines()]
n = int(myin[0])
a = [int(x) for x in myin[1].split()]
cnt = [0] * (n + 1)
for v in a:
    cnt[v] += 1
tmp = 0
for c in cnt:
    tmp += c * (c - 1) // 2
for v in a:
    print((tmp - cnt[v] + 1))

import sys

myin = sys.stdin.readlines()
n = int(myin[0])
a = [int(x) for x in myin[1].split()]
cnt = [0] * (n + 1)
for v in a:
    cnt[v] += 1
tmp = 0
for c in cnt:
    tmp += c * (c - 1) // 2
for v in a:
    print((tmp - cnt[v] + 1))

-myin = [x.rstrip() for x in sys.stdin.readlines()] +myin = sys.stdin.readlines()