from collections import Counter



mod = (10 ** 9 + 7) ** 5

MAX = 2 * 10 ** 5 + 1 # これは変動するので注意



def com_init(MAX, mod):

    fac = [0] * MAX

    finv = [0] * MAX

    inv = [0] * MAX

    fac[0] = fac[1] = 1

    finv[0] = finv[1] = 1

    inv[1] = 1

    for i in range(2, MAX):

        fac[i] = fac[i - 1] * i % mod

        inv[i] = mod - inv[mod % i] * (mod // i) % mod

        finv[i] = finv[i - 1] * inv[i] % mod

    return fac, finv



fac, finv = com_init(MAX, mod)



def nCr(n, r):

    if n < r:

        return 0

    elif n < 0 or r < 0:

        return 0

    return fac[n] * (finv[r] * finv[n - r] % mod) % mod



n = int(eval(input()))

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



counter = Counter(A)



mapping = {}

for k, v in list(counter.items()):

    mapping[k] = nCr(v, 2)



all_sum = 0

for v in list(mapping.values()):

    all_sum += v



memo = {}

for i in range(n):

    num = A[i]

    if num in memo:

        print((memo[num]))

    else:

        t = counter[num]

        ans = all_sum - nCr(t, 2) + nCr(t - 1, 2)

        print(ans)

        memo[num] = ans



from collections import Counter



# mod = (10 ** 9 + 7) ** 5

# MAX = 2 * 10 ** 5 + 1 # これは変動するので注意



# def com_init(MAX, mod):

#     fac = [0] * MAX

#     finv = [0] * MAX

#     inv = [0] * MAX

#     fac[0] = fac[1] = 1

#     finv[0] = finv[1] = 1

#     inv[1] = 1

#     for i in range(2, MAX):

#         fac[i] = fac[i - 1] * i % mod

#         inv[i] = mod - inv[mod % i] * (mod // i) % mod

#         finv[i] = finv[i - 1] * inv[i] % mod

#     return fac, finv



# fac, finv = com_init(MAX, mod)



# def nCr(n, r):

#     if n < r:

#         return 0

#     elif n < 0 or r < 0:

#         return 0

#     return fac[n] * (finv[r] * finv[n - r] % mod) % mod



# n = int(input())

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



# counter = Counter(A)



# mapping = {}

# for k, v in counter.items():

#     mapping[k] = nCr(v, 2)



# all_sum = 0

# for v in mapping.values():

#     all_sum += v



# memo = {}

# for i in range(n):

#     num = A[i]

#     if num in memo:

#         print(memo[num])

#     else:

#         t = counter[num]

#         ans = all_sum - nCr(t, 2) + nCr(t - 1, 2)

#         print(ans)

#         memo[num] = ans





# nC2というものは、わざわざこれをやる必要がなく、

# t * (t - 1) // 2で良い.

n = int(eval(input()))

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



def nC2(n):

    return n * (n - 1) // 2

counter = Counter(A)



mapping = {}

for k, v in list(counter.items()):

    mapping[k] = nC2(v)



all_sum = 0

for v in list(mapping.values()):

    all_sum += v



memo = {}

for i in range(n):

    num = A[i]

    if num in memo:

        print((memo[num]))

    else:

        t = counter[num]

        ans = all_sum - nC2(t) + nC2(t - 1)

        print(ans)

        memo[num] = ans







# 初期の回答。都度求めていたためにTLE

# memo = {}

# for i in range(n):

#     ans = 0

#     if A[i] in memo:

#         print(memo[A[i]])

#         continue

#     for k, v in counter.items():

#         if k == A[i]:

#             v -= 1

#         ans += nCr(v, 2)

#     memo[A[i]] = ans

#     print(ans)
from collections import Counter

mod = (10**9 + 7) ** 5
MAX = 2 * 10**5 + 1  # これは変動するので注意


def com_init(MAX, mod):
    fac = [0] * MAX
    finv = [0] * MAX
    inv = [0] * MAX
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod
    return fac, finv


fac, finv = com_init(MAX, mod)


def nCr(n, r):
    if n < r:
        return 0
    elif n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod


n = int(eval(input()))
A = list(map(int, input().split()))
counter = Counter(A)
mapping = {}
for k, v in list(counter.items()):
    mapping[k] = nCr(v, 2)
all_sum = 0
for v in list(mapping.values()):
    all_sum += v
memo = {}
for i in range(n):
    num = A[i]
    if num in memo:
        print((memo[num]))
    else:
        t = counter[num]
        ans = all_sum - nCr(t, 2) + nCr(t - 1, 2)
        print(ans)
        memo[num] = ans

from collections import Counter

# mod = (10 ** 9 + 7) ** 5
# MAX = 2 * 10 ** 5 + 1 # これは変動するので注意
# def com_init(MAX, mod):
#     fac = [0] * MAX
#     finv = [0] * MAX
#     inv = [0] * MAX
#     fac[0] = fac[1] = 1
#     finv[0] = finv[1] = 1
#     inv[1] = 1
#     for i in range(2, MAX):
#         fac[i] = fac[i - 1] * i % mod
#         inv[i] = mod - inv[mod % i] * (mod // i) % mod
#         finv[i] = finv[i - 1] * inv[i] % mod
#     return fac, finv
# fac, finv = com_init(MAX, mod)
# def nCr(n, r):
#     if n < r:
#         return 0
#     elif n < 0 or r < 0:
#         return 0
#     return fac[n] * (finv[r] * finv[n - r] % mod) % mod
# n = int(input())
# A = list(map(int, input().split()))
# counter = Counter(A)
# mapping = {}
# for k, v in counter.items():
#     mapping[k] = nCr(v, 2)
# all_sum = 0
# for v in mapping.values():
#     all_sum += v
# memo = {}
# for i in range(n):
#     num = A[i]
#     if num in memo:
#         print(memo[num])
#     else:
#         t = counter[num]
#         ans = all_sum - nCr(t, 2) + nCr(t - 1, 2)
#         print(ans)
#         memo[num] = ans
# nC2というものは、わざわざこれをやる必要がなく、
# t * (t - 1) // 2で良い.
n = int(eval(input()))
A = list(map(int, input().split()))


def nC2(n):
    return n * (n - 1) // 2


counter = Counter(A)
mapping = {}
for k, v in list(counter.items()):
    mapping[k] = nC2(v)
all_sum = 0
for v in list(mapping.values()):
    all_sum += v
memo = {}
for i in range(n):
    num = A[i]
    if num in memo:
        print((memo[num]))
    else:
        t = counter[num]
        ans = all_sum - nC2(t) + nC2(t - 1)
        print(ans)
        memo[num] = ans
# 初期の回答。都度求めていたためにTLE
# memo = {}
# for i in range(n):
#     ans = 0
#     if A[i] in memo:
#         print(memo[A[i]])
#         continue
#     for k, v in counter.items():
#         if k == A[i]:
#             v -= 1
#         ans += nCr(v, 2)
#     memo[A[i]] = ans
#     print(ans)

-mod = (10**9 + 7) ** 5 -MAX = 2 * 10**5 + 1  # これは変動するので注意 +# mod = (10 ** 9 + 7) ** 5 +# MAX = 2 * 10 ** 5 + 1 # これは変動するので注意 +# def com_init(MAX, mod): +#     fac = [0] * MAX +#     finv = [0] * MAX +#     inv = [0] * MAX +#     fac[0] = fac[1] = 1 +#     finv[0] = finv[1] = 1 +#     inv[1] = 1 +#     for i in range(2, MAX): +#         fac[i] = fac[i - 1] * i % mod +#         inv[i] = mod - inv[mod % i] * (mod // i) % mod +#         finv[i] = finv[i - 1] * inv[i] % mod +#     return fac, finv +# fac, finv = com_init(MAX, mod) +# def nCr(n, r): +#     if n < r: +#         return 0 +#     elif n < 0 or r < 0: +#         return 0 +#     return fac[n] * (finv[r] * finv[n - r] % mod) % mod +# n = int(input()) +# A = list(map(int, input().split())) +# counter = Counter(A) +# mapping = {} +# for k, v in counter.items(): +#     mapping[k] = nCr(v, 2) +# all_sum = 0 +# for v in mapping.values(): +#     all_sum += v +# memo = {} +# for i in range(n): +#     num = A[i] +#     if num in memo: +#         print(memo[num]) +#     else: +#         t = counter[num] +#         ans = all_sum - nCr(t, 2) + nCr(t - 1, 2) +#         print(ans) +#         memo[num] = ans +# nC2というものは、わざわざこれをやる必要がなく、 +# t * (t - 1) // 2で良い. +n = int(eval(input())) +A = list(map(int, input().split())) -def com_init(MAX, mod): -    fac = [0] * MAX -    finv = [0] * MAX -    inv = [0] * MAX -    fac[0] = fac[1] = 1 -    finv[0] = finv[1] = 1 -    inv[1] = 1 -    for i in range(2, MAX): -        fac[i] = fac[i - 1] * i % mod -        inv[i] = mod - inv[mod % i] * (mod // i) % mod -        finv[i] = finv[i - 1] * inv[i] % mod -    return fac, finv +def nC2(n): +    return n * (n - 1) // 2 -fac, finv = com_init(MAX, mod) - - -def nCr(n, r): -    if n < r: -        return 0 -    elif n < 0 or r < 0: -        return 0 -    return fac[n] * (finv[r] * finv[n - r] % mod) % mod - - -n = int(eval(input())) -A = list(map(int, input().split())) -    mapping[k] = nCr(v, 2) +    mapping[k] = nC2(v) -        ans = all_sum - nCr(t, 2) + nCr(t - 1, 2) +        ans = all_sum - nC2(t) + nC2(t - 1) +# 初期の回答。都度求めていたためにTLE +# memo = {} +# for i in range(n): +#     ans = 0 +#     if A[i] in memo: +#         print(memo[A[i]]) +#         continue +#     for k, v in counter.items(): +#         if k == A[i]: +#             v -= 1 +#         ans += nCr(v, 2) +#     memo[A[i]] = ans +#     print(ans)