import collections

import math



def combinations_count(n, r):

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



N = int(eval(input()))

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



counts = collections.Counter(A_list)

ans = 0

for _, v in list(counts.items()):

    # ans += len(list(itertools.combinations(range(v), 2)))

    if v > 1:

        ans += combinations_count(v, 2)



for k in range(1, N + 1):

    n = counts[A_list[k - 1]]

    ans_k = ans

    if n > 1:

        ans_k -= n - 1



    print((int(ans_k)))
import collections



# def combinations_count(n, r):

#     return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



N = int(eval(input()))

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



counts = collections.Counter(A_list)

ans = 0

for _, v in list(counts.items()):

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



for k in range(1, N + 1):

    n = counts[A_list[k - 1]]

    ans_k = ans

    if n > 1:

        ans_k -= n - 1



    print((int(ans_k)))
import collections
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N = int(eval(input()))
A_list = list(map(int, input().split()))
counts = collections.Counter(A_list)
ans = 0
for _, v in list(counts.items()):
    # ans += len(list(itertools.combinations(range(v), 2)))
    if v > 1:
        ans += combinations_count(v, 2)
for k in range(1, N + 1):
    n = counts[A_list[k - 1]]
    ans_k = ans
    if n > 1:
        ans_k -= n - 1
    print((int(ans_k)))

import collections

# def combinations_count(n, r):
#     return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N = int(eval(input()))
A_list = list(map(int, input().split()))
counts = collections.Counter(A_list)
ans = 0
for _, v in list(counts.items()):
    ans += v * (v - 1) / 2
for k in range(1, N + 1):
    n = counts[A_list[k - 1]]
    ans_k = ans
    if n > 1:
        ans_k -= n - 1
    print((int(ans_k)))

-import math - -def combinations_count(n, r): -    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) - - +# def combinations_count(n, r): +#     return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) -    # ans += len(list(itertools.combinations(range(v), 2))) -    if v > 1: -        ans += combinations_count(v, 2) +    ans += v * (v - 1) / 2