from math import factorial



N = int(eval(input()))

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





def comb(n, r):

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





counts = [0] * (N + 1)

for a in A:

    counts[a] += 1

total = sum([comb(n, 2) for n in [n for n in counts if n > 1]])



for a in A:

    print((total - (counts[a] - 1)))

N = int(eval(input()))

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





def comb2(n):

    return n * (n - 1) // 2





counts = [0] * (N + 1)

for a in A:

    counts[a] += 1

total = sum([comb2(n) for n in [n for n in counts if n > 1]])



for a in A:

    print((total - (counts[a] - 1)))

from math import factorial

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


def comb(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))


counts = [0] * (N + 1)
for a in A:
    counts[a] += 1
total = sum([comb(n, 2) for n in [n for n in counts if n > 1]])
for a in A:
    print((total - (counts[a] - 1)))

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


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


counts = [0] * (N + 1)
for a in A:
    counts[a] += 1
total = sum([comb2(n) for n in [n for n in counts if n > 1]])
for a in A:
    print((total - (counts[a] - 1)))

-from math import factorial - -def comb(n, r): -    return factorial(n) // (factorial(n - r) * factorial(r)) +def comb2(n): +    return n * (n - 1) // 2 -total = sum([comb(n, 2) for n in [n for n in counts if n > 1]]) +total = sum([comb2(n) for n in [n for n in counts if n > 1]])