import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=10**9+7

    N=I()

    A=LI()

    from collections import defaultdict

    dd = defaultdict(int)

    

    for i in range(N):

        dd[A[i]]+=1

        

    S=0

    for k,v in list(dd.items()):

        S+=(v*(v-1))//2

        

    for i in range(N):

        v=dd[A[i]]

        ans=S-(v-1)

        print(ans)



main()

import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=10**9+7

    N=I()

    A=LI()

    from collections import defaultdict

    dd = defaultdict(int)

    

    for i in range(N):

        dd[A[i]]+=1

    

    ans=0

    for k,v in list(dd.items()):

        ans+=(v*(v-1))//2

        

    for i in range(N):

        a=A[i]

        v=dd[A[i]]

        temp=ans

        temp-=(v*(v-1))//2

        temp+=((v-1)*(v-2))//2

        

        print(temp)

    

main()

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 10**9 + 7
    N = I()
    A = LI()
    from collections import defaultdict

    dd = defaultdict(int)
    for i in range(N):
        dd[A[i]] += 1
    S = 0
    for k, v in list(dd.items()):
        S += (v * (v - 1)) // 2
    for i in range(N):
        v = dd[A[i]]
        ans = S - (v - 1)
        print(ans)


main()

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 10**9 + 7
    N = I()
    A = LI()
    from collections import defaultdict

    dd = defaultdict(int)
    for i in range(N):
        dd[A[i]] += 1
    ans = 0
    for k, v in list(dd.items()):
        ans += (v * (v - 1)) // 2
    for i in range(N):
        a = A[i]
        v = dd[A[i]]
        temp = ans
        temp -= (v * (v - 1)) // 2
        temp += ((v - 1) * (v - 2)) // 2
        print(temp)


main()

-    S = 0 +    ans = 0 -        S += (v * (v - 1)) // 2 +        ans += (v * (v - 1)) // 2 +        a = A[i] -        ans = S - (v - 1) -        print(ans) +        temp = ans +        temp -= (v * (v - 1)) // 2 +        temp += ((v - 1) * (v - 2)) // 2 +        print(temp)