n = int(eval(input()))

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



c = [0]*n



for i in range(n):

    c[a[i]-1] = c[a[i]-1] + 1

    

total = 0

for x in c:

    total = total + x*(x-1)//2



for i in range(n):

    print((total - c[a[i]-1] + 1))

import copy

N = int(eval(input()))

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



count_dict = [0] * N

for each in A:

    count_dict[each - 1] += 1



all_types = 0

for value in count_dict:

    all_types += value * (value - 1) // 2



# result_dict = {}

# for each in a_types:

#     result_dict[each] = all_types - count_dict[each] + 1



for a in A:

    print((all_types - count_dict[a - 1] + 1))
n = int(eval(input()))
a = list(map(int, input().split()))
c = [0] * n
for i in range(n):
    c[a[i] - 1] = c[a[i] - 1] + 1
total = 0
for x in c:
    total = total + x * (x - 1) // 2
for i in range(n):
    print((total - c[a[i] - 1] + 1))

import copy

N = int(eval(input()))
A = list(map(int, input().split()))
count_dict = [0] * N
for each in A:
    count_dict[each - 1] += 1
all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2
# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1
for a in A:
    print((all_types - count_dict[a - 1] + 1))

-n = int(eval(input())) -a = list(map(int, input().split())) -c = [0] * n -for i in range(n): -    c[a[i] - 1] = c[a[i] - 1] + 1 -total = 0 -for x in c: -    total = total + x * (x - 1) // 2 -for i in range(n): -    print((total - c[a[i] - 1] + 1)) +import copy + +N = int(eval(input())) +A = list(map(int, input().split())) +count_dict = [0] * N +for each in A: +    count_dict[each - 1] += 1 +all_types = 0 +for value in count_dict: +    all_types += value * (value - 1) // 2 +# result_dict = {} +# for each in a_types: +#     result_dict[each] = all_types - count_dict[each] + 1 +for a in A: +    print((all_types - count_dict[a - 1] + 1))