from collections import Counter

import math



def solver():

    N = int(eval(input()))

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



    cnt = Counter(A)

    # print(cnt)

    def comb(n, r):

        if n - r < 0: return 0

        if n - r < r: r = n - r

        if r == 0: return 1

        if r == 1: return n



        numerator = [n - r + k + 1 for k in range(r)]

        denominator = [k + 1 for k in range(r)]



        for p in range(2, r + 1):

            pivot = denominator[p - 1]

            if pivot > 1:

                offset = (n - r) % p

                for k in range(p - 1, r, p):

                    numerator[k - offset] /= pivot

                    denominator[k] /= pivot



        result = 1

        for k in range(r):

            if numerator[k] > 1:

                result *= int(numerator[k])



        return result

    cnt_comb = {}

    sm = 0

    for key, val in list(cnt.items()):

        tmp = comb(val, 2)

        cnt_comb[key] = tmp

        sm = sm + tmp

    # print(cnt_comb)



    # print(list(A))

    for a in A:

        comb_val = cnt_comb.get(a)

        cmb = comb(cnt.get(a) - 1, 2)

        print((sm - comb_val + cmb))







if __name__ == '__main__':

    solver()

import sys

sys.setrecursionlimit(10 ** 6)

# input = sys.stdin.readline    ####

int1 = lambda x: int(x) - 1

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



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

def MI1(): return list(map(int1, input().split()))



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

def LI1(): return list(map(int1, input().split()))

def LLI(rows_number): return [LI() for _ in range(rows_number)]



INF = float('inf')



def solve():

    n = II()

    A = LI()



    memo = {}

    for a in A:

        memo[a] = memo.get(a, 0) + 1



    def choose2(a):

        if a == 0: return 0

        return a * (a-1) // 2



    # print(memo)

    ans = 0

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

        ans = ans + choose2(v)

    # print(ans)



    for a in A:

        print((ans - choose2(memo[a]) + choose2(memo[a] - 1)))





if __name__ == '__main__':

    solve()

from collections import Counter
import math


def solver():
    N = int(eval(input()))
    A = list(map(int, input().split()))
    cnt = Counter(A)
    # print(cnt)
    def comb(n, r):
        if n - r < 0:
            return 0
        if n - r < r:
            r = n - r
        if r == 0:
            return 1
        if r == 1:
            return n
        numerator = [n - r + k + 1 for k in range(r)]
        denominator = [k + 1 for k in range(r)]
        for p in range(2, r + 1):
            pivot = denominator[p - 1]
            if pivot > 1:
                offset = (n - r) % p
                for k in range(p - 1, r, p):
                    numerator[k - offset] /= pivot
                    denominator[k] /= pivot
        result = 1
        for k in range(r):
            if numerator[k] > 1:
                result *= int(numerator[k])
        return result

    cnt_comb = {}
    sm = 0
    for key, val in list(cnt.items()):
        tmp = comb(val, 2)
        cnt_comb[key] = tmp
        sm = sm + tmp
    # print(cnt_comb)
    # print(list(A))
    for a in A:
        comb_val = cnt_comb.get(a)
        cmb = comb(cnt.get(a) - 1, 2)
        print((sm - comb_val + cmb))


if __name__ == "__main__":
    solver()

import sys

sys.setrecursionlimit(10**6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1


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


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


def MI1():
    return list(map(int1, input().split()))


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


def LI1():
    return list(map(int1, input().split()))


def LLI(rows_number):
    return [LI() for _ in range(rows_number)]


INF = float("inf")


def solve():
    n = II()
    A = LI()
    memo = {}
    for a in A:
        memo[a] = memo.get(a, 0) + 1

    def choose2(a):
        if a == 0:
            return 0
        return a * (a - 1) // 2

    # print(memo)
    ans = 0
    for k, v in list(memo.items()):
        ans = ans + choose2(v)
    # print(ans)
    for a in A:
        print((ans - choose2(memo[a]) + choose2(memo[a] - 1)))


if __name__ == "__main__":
    solve()

-from collections import Counter -import math +import sys + +sys.setrecursionlimit(10**6) +# input = sys.stdin.readline    #### +int1 = lambda x: int(x) - 1 -def solver(): -    N = int(eval(input())) -    A = list(map(int, input().split())) -    cnt = Counter(A) -    # print(cnt) -    def comb(n, r): -        if n - r < 0: +def II(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def MI1(): +    return list(map(int1, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def LI1(): +    return list(map(int1, input().split())) + + +def LLI(rows_number): +    return [LI() for _ in range(rows_number)] + + +INF = float("inf") + + +def solve(): +    n = II() +    A = LI() +    memo = {} +    for a in A: +        memo[a] = memo.get(a, 0) + 1 + +    def choose2(a): +        if a == 0: -        if n - r < r: -            r = n - r -        if r == 0: -            return 1 -        if r == 1: -            return n -        numerator = [n - r + k + 1 for k in range(r)] -        denominator = [k + 1 for k in range(r)] -        for p in range(2, r + 1): -            pivot = denominator[p - 1] -            if pivot > 1: -                offset = (n - r) % p -                for k in range(p - 1, r, p): -                    numerator[k - offset] /= pivot -                    denominator[k] /= pivot -        result = 1 -        for k in range(r): -            if numerator[k] > 1: -                result *= int(numerator[k]) -        return result +        return a * (a - 1) // 2 -    cnt_comb = {} -    sm = 0 -    for key, val in list(cnt.items()): -        tmp = comb(val, 2) -        cnt_comb[key] = tmp -        sm = sm + tmp -    # print(cnt_comb) -    # print(list(A)) +    # print(memo) +    ans = 0 +    for k, v in list(memo.items()): +        ans = ans + choose2(v) +    # print(ans) -        comb_val = cnt_comb.get(a) -        cmb = comb(cnt.get(a) - 1, 2) -        print((sm - comb_val + cmb)) +        print((ans - choose2(memo[a]) + choose2(memo[a] - 1))) -    solver() +    solve()