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()))
def ban():

    n = int(eval(input()))

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

    d = {}

    total = 0



    for i in a:

        if i not in d:

            d[i] = 1

        else:

            total += d[i]

            d[i] += 1



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

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



print((ban()))
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()))

def ban():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    d = {}
    total = 0
    for i in a:
        if i not in d:
            d[i] = 1
        else:
            total += d[i]
            d[i] += 1
    ans = [total - (d[i] - 1) for i in a]
    return "\n".join(map(str, ans))


print((ban()))

-    from collections import Counter - -    b = Counter(a) -    total = sum(i * (i - 1) // 2 for i in list(b.values())) -    ans = [(total - (b[i] - 1)) for i in a] +    d = {} +    total = 0 +    for i in a: +        if i not in d: +            d[i] = 1 +        else: +            total += d[i] +            d[i] += 1 +    ans = [total - (d[i] - 1) for i in a]