from collections import Counter

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

cnt_dict, cnt_total = Counter(li), 0

for i in list(cnt_dict.items()):

    cnt_total += i[1] * (i[1]-1) // 2

for k in range(N):

    buf = cnt_dict[li[k]]

    print((cnt_total - buf*(buf-1)//2 + (buf-1)*(buf-2)//2))
from collections import Counter

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

cnt_dict, cnt_total = Counter(li), 0

cnt_total =sum([i[1] * (i[1]-1) // 2 for i in list(cnt_dict.items())])

for k in range(N):

    print((cnt_total - cnt_dict[li[k]]*(cnt_dict[li[k]]-1)//2 + (cnt_dict[li[k]]-1)*(cnt_dict[li[k]]-2)//2))
from collections import Counter

N, li = int(eval(input())), list(map(int, input().split()))
cnt_dict, cnt_total = Counter(li), 0
for i in list(cnt_dict.items()):
    cnt_total += i[1] * (i[1] - 1) // 2
for k in range(N):
    buf = cnt_dict[li[k]]
    print((cnt_total - buf * (buf - 1) // 2 + (buf - 1) * (buf - 2) // 2))

from collections import Counter

N, li = int(eval(input())), list(map(int, input().split()))
cnt_dict, cnt_total = Counter(li), 0
cnt_total = sum([i[1] * (i[1] - 1) // 2 for i in list(cnt_dict.items())])
for k in range(N):
    print(
        (
            cnt_total
            - cnt_dict[li[k]] * (cnt_dict[li[k]] - 1) // 2
            + (cnt_dict[li[k]] - 1) * (cnt_dict[li[k]] - 2) // 2
        )
    )

-for i in list(cnt_dict.items()): -    cnt_total += i[1] * (i[1] - 1) // 2 +cnt_total = sum([i[1] * (i[1] - 1) // 2 for i in list(cnt_dict.items())]) -    buf = cnt_dict[li[k]] -    print((cnt_total - buf * (buf - 1) // 2 + (buf - 1) * (buf - 2) // 2)) +    print( +        ( +            cnt_total +            - cnt_dict[li[k]] * (cnt_dict[li[k]] - 1) // 2 +            + (cnt_dict[li[k]] - 1) * (cnt_dict[li[k]] - 2) // 2 +        ) +    )