import sys

from collections import Counter



read = sys.stdin.read

readline = sys.stdin.readline



N, *A = list(map(int, read().split()))

a = Counter(A)

s = sum(i * (i - 1) // 2 for i in list(a.values()))



for i in A:

    v = a[i]

    answer = s - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2

    print(answer)

import sys

from collections import Counter

import numpy as np



read = sys.stdin.read

readline = sys.stdin.readline



N, *A = list(map(int, read().split()))

a = Counter(A)

s = sum(i * (i - 1) // 2 for i in list(a.values()))

val = np.array([a[i] for i in A], np.int64)

answer = s - val * (val - 1) // 2 + (val - 1) * (val - 2) // 2

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

import sys
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline
N, *A = list(map(int, read().split()))
a = Counter(A)
s = sum(i * (i - 1) // 2 for i in list(a.values()))
for i in A:
    v = a[i]
    answer = s - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2
    print(answer)

import sys
from collections import Counter
import numpy as np

read = sys.stdin.read
readline = sys.stdin.readline
N, *A = list(map(int, read().split()))
a = Counter(A)
s = sum(i * (i - 1) // 2 for i in list(a.values()))
val = np.array([a[i] for i in A], np.int64)
answer = s - val * (val - 1) // 2 + (val - 1) * (val - 2) // 2
print(("\n".join(map(str, answer.tolist()))))

+import numpy as np -for i in A: -    v = a[i] -    answer = s - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2 -    print(answer) +val = np.array([a[i] for i in A], np.int64) +answer = s - val * (val - 1) // 2 + (val - 1) * (val - 2) // 2 +print(("\n".join(map(str, answer.tolist()))))