# coding: utf-8

N = int(eval(input()))

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



dict = {}

for i in range(N):

  if A[i] in list(dict.keys()):

    dict[A[i]] += 1

  else:

    dict[A[i]] = 1



def comb(n):

  if n<2:

    return 0

  return int(n * (n - 1) / 2)



# all

ret = 0

for key in list(dict.keys()):

  val = dict[key]

  ret += comb(val)



# i >= 0

for i in range(N):

  val_n = dict[A[i]]

  next_ret = ret - comb(val_n) + comb(val_n - 1)

  print(next_ret)
# coding: utf-8

import sys

#from operator import itemgetter

sysread = sys.stdin.buffer.readline

read = sys.stdin.buffer.read

#from heapq import heappop, heappush

#from collections import defaultdict

sys.setrecursionlimit(10**7)

#import math

#from itertools import product#accumulate, combinations, product

#import bisect# lower_bound etc

#import numpy as np

#from copy import deepcopy

#from collections import deque

def run():

    N = int(sysread())

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

    count = [0] * (N+1)

    for val in A:

        count[val] += 1

    base_sum = 0

    for val in count:

        if val <= 1:continue

        base_sum += val * (val-1) // 2

    for i in range(N):

        if count[A[i]] == 1:

            print(base_sum)

        else:

            print((base_sum - count[A[i]] + 1))

if __name__ == "__main__":

    run()

# coding: utf-8
N = int(eval(input()))
A = list(map(int, input().split()))
dict = {}
for i in range(N):
    if A[i] in list(dict.keys()):
        dict[A[i]] += 1
    else:
        dict[A[i]] = 1


def comb(n):
    if n < 2:
        return 0
    return int(n * (n - 1) / 2)


# all
ret = 0
for key in list(dict.keys()):
    val = dict[key]
    ret += comb(val)
# i >= 0
for i in range(N):
    val_n = dict[A[i]]
    next_ret = ret - comb(val_n) + comb(val_n - 1)
    print(next_ret)

# coding: utf-8
import sys

# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
# from heapq import heappop, heappush
# from collections import defaultdict
sys.setrecursionlimit(10**7)
# import math
# from itertools import product#accumulate, combinations, product
# import bisect# lower_bound etc
# import numpy as np
# from copy import deepcopy
# from collections import deque
def run():
    N = int(sysread())
    A = list(map(int, sysread().split()))
    count = [0] * (N + 1)
    for val in A:
        count[val] += 1
    base_sum = 0
    for val in count:
        if val <= 1:
            continue
        base_sum += val * (val - 1) // 2
    for i in range(N):
        if count[A[i]] == 1:
            print(base_sum)
        else:
            print((base_sum - count[A[i]] + 1))


if __name__ == "__main__":
    run()

-N = int(eval(input())) -A = list(map(int, input().split())) -dict = {} -for i in range(N): -    if A[i] in list(dict.keys()): -        dict[A[i]] += 1 -    else: -        dict[A[i]] = 1 +import sys + +# from operator import itemgetter +sysread = sys.stdin.buffer.readline +read = sys.stdin.buffer.read +# from heapq import heappop, heappush +# from collections import defaultdict +sys.setrecursionlimit(10**7) +# import math +# from itertools import product#accumulate, combinations, product +# import bisect# lower_bound etc +# import numpy as np +# from copy import deepcopy +# from collections import deque +def run(): +    N = int(sysread()) +    A = list(map(int, sysread().split())) +    count = [0] * (N + 1) +    for val in A: +        count[val] += 1 +    base_sum = 0 +    for val in count: +        if val <= 1: +            continue +        base_sum += val * (val - 1) // 2 +    for i in range(N): +        if count[A[i]] == 1: +            print(base_sum) +        else: +            print((base_sum - count[A[i]] + 1)) -def comb(n): -    if n < 2: -        return 0 -    return int(n * (n - 1) / 2) - - -# all -ret = 0 -for key in list(dict.keys()): -    val = dict[key] -    ret += comb(val) -# i >= 0 -for i in range(N): -    val_n = dict[A[i]] -    next_ret = ret - comb(val_n) + comb(val_n - 1) -    print(next_ret) +if __name__ == "__main__": +    run()