# coding: utf-8

import sys

from math import factorial

from collections import Counter, defaultdict



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



def comb(n, r):  # 組み合わせ

    if n <= 0 or r > n: return 0

    return factorial(n) // factorial(n - r) // factorial(r)



N = ir()

A = lr()

counter = Counter(A)

case = 0

dic = defaultdict(int)

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

    dic[k] = v

    case += comb(v, 2)



for a in A:

    num = dic[a]

    answer = case - (num - 1)

    print(answer)

# coding: utf-8

import sys

import numpy as np



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

A = np.array(lr(), dtype=np.int32)

counter = np.bincount(A)

case = (counter * (counter-1) // 2).sum()

answer = case - (counter[A] - 1)

print(('\n'.join(map(str, answer))))

# coding: utf-8
import sys
from math import factorial
from collections import Counter, defaultdict

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))


def comb(n, r):  # 組み合わせ
    if n <= 0 or r > n:
        return 0
    return factorial(n) // factorial(n - r) // factorial(r)


N = ir()
A = lr()
counter = Counter(A)
case = 0
dic = defaultdict(int)
for k, v in list(counter.items()):
    dic[k] = v
    case += comb(v, 2)
for a in A:
    num = dic[a]
    answer = case - (num - 1)
    print(answer)

# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.array(lr(), dtype=np.int32)
counter = np.bincount(A)
case = (counter * (counter - 1) // 2).sum()
answer = case - (counter[A] - 1)
print(("\n".join(map(str, answer))))

-from math import factorial -from collections import Counter, defaultdict +import numpy as np - - -def comb(n, r):  # 組み合わせ -    if n <= 0 or r > n: -        return 0 -    return factorial(n) // factorial(n - r) // factorial(r) - - -A = lr() -counter = Counter(A) -case = 0 -dic = defaultdict(int) -for k, v in list(counter.items()): -    dic[k] = v -    case += comb(v, 2) -for a in A: -    num = dic[a] -    answer = case - (num - 1) -    print(answer) +A = np.array(lr(), dtype=np.int32) +counter = np.bincount(A) +case = (counter * (counter - 1) // 2).sum() +answer = case - (counter[A] - 1) +print(("\n".join(map(str, answer))))