# -*- coding: utf-8 -*-

import collections



def cmb(n, r):

    if n - r < r: r = n - r

    if r == 0: return 1

    if r == 1: return n

    if n == 0: return 0

    if n == 1: return 0



    numerator = [n - r + k + 1 for k in range(r)]

    denominator = [k + 1 for k in range(r)]



    for p in range(2,r+1):

        pivot = denominator[p - 1]

        if pivot > 1:

            offset = (n - r) % p

            for k in range(p-1,r,p):

                numerator[k - offset] /= pivot

                denominator[k] /= pivot



    result = 1

    for k in range(r):

        if numerator[k] > 1:

            result *= int(numerator[k])



    return result





"""

def cmb(n, r):

    if (r < 0) or (n < r):

        return 0

    r = min(r, n - r)

    return fact[n] * factinv[r] * factinv[n-r] % mod



N = 3 * pow(10, 5)  # N は必要分だけ用意する

mod = pow(10, 9) + 7

fact = [1, 1]  # fact[n] = (n! mod p)

factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)

inv = [0, 1]  # factinv 計算用



for i in range(2, N + 1):

    fact.append((fact[-1] * i) % mod)

    #fact.append(fact[-1] * i)

    inv.append((-inv[mod % i] * (mod // i)) % mod)

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

    factinv.append((factinv[-1] * inv[-1]) % mod)

    #factinv.append(factinv[-1] * inv[-1])

"""



n = int(eval(input()))

a = [int(i) for i in input().split()] 



count = [0 for _ in range(n+1)]

ans = [0 for _ in range(n+1)]

c = collections.Counter(a)

#print(c)

for i in range(n+1):

    #tmp = a.count(i)

    tmp = c[i]

    #print(tmp)

    count[i] = tmp

    ans[i] = cmb(tmp, 2)

    #print(tmp, ans[i])

#print(count, ans)

sum_ans = sum(ans)

#print(sum_ans)

for k in range(n):

    #count[k] -= 1

    #print(a[k], count[a[k]])

    #print(count[a[k]] - 1 ,cmb(count[a[k]]-1, 2))

    #print(count[a[k]] ,cmb(count[a[k]], 2))

    ans = sum_ans + cmb(count[a[k]]-1, 2) - cmb(count[a[k]], 2)

    print(ans)

""" スニペット """

def get_int():

	return int(eval(input()))



def get_ints():

	return list(map(int, input().split()))

""" スニペット """

import math

# 2つ選ぶ通り数を算出 nC2

def choose2(n):

    return n*(n-1)//2

# インプット

N = get_int()

An = get_ints()

""" 全ての要素から2つのボールを選ぶ通り数を求める """

uni = [0] * (N+1)

# ユニーク数の配列を求める

for i in range(N):

    uni[An[i]] += 1

sumWay = 0

# 各数値の2通りの選択通り数を足していく

for i in range(N + 1):

    sumWay += choose2(uni[i])

""" 全ての要素数 - 削除する要素の通り数 + 削除する要素を引いた際の通り数 を求める """

for i in range(N):

    print((sumWay - choose2(uni[An[i]]) + choose2(uni[An[i]]-1))) 



# -*- coding: utf-8 -*-
import collections


def cmb(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n
    if n == 0:
        return 0
    if n == 1:
        return 0
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
    return result


"""
def cmb(n, r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
N = 3 * pow(10, 5)  # N は必要分だけ用意する
mod = pow(10, 9) + 7
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % mod)
    #fact.append(fact[-1] * i)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    #inv.append(-inv[mod%i] * (mod // i))
    factinv.append((factinv[-1] * inv[-1]) % mod)
    #factinv.append(factinv[-1] * inv[-1])
"""
n = int(eval(input()))
a = [int(i) for i in input().split()]
count = [0 for _ in range(n + 1)]
ans = [0 for _ in range(n + 1)]
c = collections.Counter(a)
# print(c)
for i in range(n + 1):
    # tmp = a.count(i)
    tmp = c[i]
    # print(tmp)
    count[i] = tmp
    ans[i] = cmb(tmp, 2)
    # print(tmp, ans[i])
# print(count, ans)
sum_ans = sum(ans)
# print(sum_ans)
for k in range(n):
    # count[k] -= 1
    # print(a[k], count[a[k]])
    # print(count[a[k]] - 1 ,cmb(count[a[k]]-1, 2))
    # print(count[a[k]] ,cmb(count[a[k]], 2))
    ans = sum_ans + cmb(count[a[k]] - 1, 2) - cmb(count[a[k]], 2)
    print(ans)

""" スニペット """


def get_int():
    return int(eval(input()))


def get_ints():
    return list(map(int, input().split()))


""" スニペット """
import math

# 2つ選ぶ通り数を算出 nC2
def choose2(n):
    return n * (n - 1) // 2


# インプット
N = get_int()
An = get_ints()
""" 全ての要素から2つのボールを選ぶ通り数を求める """
uni = [0] * (N + 1)
# ユニーク数の配列を求める
for i in range(N):
    uni[An[i]] += 1
sumWay = 0
# 各数値の2通りの選択通り数を足していく
for i in range(N + 1):
    sumWay += choose2(uni[i])
""" 全ての要素数 - 削除する要素の通り数 + 削除する要素を引いた際の通り数 を求める """
for i in range(N):
    print((sumWay - choose2(uni[An[i]]) + choose2(uni[An[i]] - 1)))

-# -*- coding: utf-8 -*- -import collections +""" スニペット """ -def cmb(n, r): -    if n - r < r: -        r = n - r -    if r == 0: -        return 1 -    if r == 1: -        return n -    if n == 0: -        return 0 -    if n == 1: -        return 0 -    numerator = [n - r + k + 1 for k in range(r)] -    denominator = [k + 1 for k in range(r)] -    for p in range(2, r + 1): -        pivot = denominator[p - 1] -        if pivot > 1: -            offset = (n - r) % p -            for k in range(p - 1, r, p): -                numerator[k - offset] /= pivot -                denominator[k] /= pivot -    result = 1 -    for k in range(r): -        if numerator[k] > 1: -            result *= int(numerator[k]) -    return result +def get_int(): +    return int(eval(input())) -""" -def cmb(n, r): -    if (r < 0) or (n < r): -        return 0 -    r = min(r, n - r) -    return fact[n] * factinv[r] * factinv[n-r] % mod -N = 3 * pow(10, 5)  # N は必要分だけ用意する -mod = pow(10, 9) + 7 -fact = [1, 1]  # fact[n] = (n! mod p) -factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p) -inv = [0, 1]  # factinv 計算用 -for i in range(2, N + 1): -    fact.append((fact[-1] * i) % mod) -    #fact.append(fact[-1] * i) -    inv.append((-inv[mod % i] * (mod // i)) % mod) -    #inv.append(-inv[mod%i] * (mod // i)) -    factinv.append((factinv[-1] * inv[-1]) % mod) -    #factinv.append(factinv[-1] * inv[-1]) -""" -n = int(eval(input())) -a = [int(i) for i in input().split()] -count = [0 for _ in range(n + 1)] -ans = [0 for _ in range(n + 1)] -c = collections.Counter(a) -# print(c) -for i in range(n + 1): -    # tmp = a.count(i) -    tmp = c[i] -    # print(tmp) -    count[i] = tmp -    ans[i] = cmb(tmp, 2) -    # print(tmp, ans[i]) -# print(count, ans) -sum_ans = sum(ans) -# print(sum_ans) -for k in range(n): -    # count[k] -= 1 -    # print(a[k], count[a[k]]) -    # print(count[a[k]] - 1 ,cmb(count[a[k]]-1, 2)) -    # print(count[a[k]] ,cmb(count[a[k]], 2)) -    ans = sum_ans + cmb(count[a[k]] - 1, 2) - cmb(count[a[k]], 2) -    print(ans) +def get_ints(): +    return list(map(int, input().split())) + + +""" スニペット """ +import math + +# 2つ選ぶ通り数を算出 nC2 +def choose2(n): +    return n * (n - 1) // 2 + + +# インプット +N = get_int() +An = get_ints() +""" 全ての要素から2つのボールを選ぶ通り数を求める """ +uni = [0] * (N + 1) +# ユニーク数の配列を求める +for i in range(N): +    uni[An[i]] += 1 +sumWay = 0 +# 各数値の2通りの選択通り数を足していく +for i in range(N + 1): +    sumWay += choose2(uni[i]) +""" 全ての要素数 - 削除する要素の通り数 + 削除する要素を引いた際の通り数 を求める """ +for i in range(N): +    print((sumWay - choose2(uni[An[i]]) + choose2(uni[An[i]] - 1)))