from functools import reduce
def d_banned_k():

    from collections import Counter

    from functools import reduce

    N = int(eval(input()))

    A = [int(i) for i in input().split()]



    def comb(n, r):

        numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1)))

        denominator = reduce(lambda x, y: x * y, list(range(1, r + 1)))

        return numerator // denominator



    count = Counter(A)

    total = sum(comb(c, 2) for c in list(count.values()))



    ans = []

    for a in A:

        v = count[a]

        ans.append(total - comb(v, 2) + comb(v - 1, 2))

    return ' '.join(map(str, ans))



print((d_banned_k()))
def d_banned_k():

    from collections import Counter

    N = int(eval(input()))

    A = [int(i) for i in input().split()]



    count = Counter(A)

    total = sum(c * (c - 1) // 2 for c in list(count.values()))



    ans = [total - (count[a] - 1) for a in A]

    return ' '.join(map(str, ans))



print((d_banned_k()))
from functools import reduce


def d_banned_k():
    from collections import Counter
    from functools import reduce

    N = int(eval(input()))
    A = [int(i) for i in input().split()]

    def comb(n, r):
        numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1)))
        denominator = reduce(lambda x, y: x * y, list(range(1, r + 1)))
        return numerator // denominator

    count = Counter(A)
    total = sum(comb(c, 2) for c in list(count.values()))
    ans = []
    for a in A:
        v = count[a]
        ans.append(total - comb(v, 2) + comb(v - 1, 2))
    return " ".join(map(str, ans))


print((d_banned_k()))

def d_banned_k():
    from collections import Counter

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


print((d_banned_k()))

-from functools import reduce - - -    from functools import reduce - -    def comb(n, r): -        numerator = reduce(lambda x, y: x * y, list(range(n, n - r, -1))) -        denominator = reduce(lambda x, y: x * y, list(range(1, r + 1))) -        return numerator // denominator - -    total = sum(comb(c, 2) for c in list(count.values())) -    ans = [] -    for a in A: -        v = count[a] -        ans.append(total - comb(v, 2) + comb(v - 1, 2)) +    total = sum(c * (c - 1) // 2 for c in list(count.values())) +    ans = [total - (count[a] - 1) for a in A]