### BUGGY CODE ###

# -*- 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(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)


### FIXED CODE ###

# -*- 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(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)