from collections import Counter



n = int(eval(input()))

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

b = Counter(a)

total = sum(i*(i - 1)//2 for i in list(b.values()))



for i in a:

    print((total - (b[i] - 1)))
def ban():

    from collections import Counter

    n = int(eval(input()))

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

    b = Counter(a)

    total = sum(i*(i - 1)//2 for i in list(b.values()))



    ans = [(total - (b[i] - 1)) for i in a]

    return "\n".join(map(str, ans))



print((ban()))
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
b = Counter(a)
total = sum(i * (i - 1) // 2 for i in list(b.values()))
for i in a:
    print((total - (b[i] - 1)))

def ban():
    from collections import Counter

    n = int(eval(input()))
    a = list(map(int, input().split()))
    b = Counter(a)
    total = sum(i * (i - 1) // 2 for i in list(b.values()))
    ans = [(total - (b[i] - 1)) for i in a]
    return "\n".join(map(str, ans))


print((ban()))

-from collections import Counter +def ban(): +    from collections import Counter -n = int(eval(input())) -a = list(map(int, input().split())) -b = Counter(a) -total = sum(i * (i - 1) // 2 for i in list(b.values())) -for i in a: -    print((total - (b[i] - 1))) +    n = int(eval(input())) +    a = list(map(int, input().split())) +    b = Counter(a) +    total = sum(i * (i - 1) // 2 for i in list(b.values())) +    ans = [(total - (b[i] - 1)) for i in a] +    return "\n".join(map(str, ans)) + + +print((ban()))