N = int(eval(input()))

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



# A_set = list(set(A))

# Ad = {a_set:A.count(a_set) for a_set in A_set}

Ad = {}

for i in A:

  if not i in Ad:

    Ad[i]=0

  Ad[i] += 1



score_sum = sum([x*(x-1)/2 for x in list(Ad.values())])



for a in A:

    print((int(score_sum - (Ad[a] - 1))))

import collections



N = int(eval(input()))

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



Ad = dict(collections.Counter(A))

# A_set = list(set(A))

# Ad = {a_set:A.count(a_set) for a_set in A_set}

# Ad = {}

# for i in A:

#   if not i in Ad:

#     Ad[i]=0

#   Ad[i] += 1



score_sum = sum([x*(x-1)/2 for x in list(Ad.values())])



for a in A:

    print((int(score_sum - (Ad[a] - 1))))

N = int(eval(input()))
A = list(map(int, input().split()))
# A_set = list(set(A))
# Ad = {a_set:A.count(a_set) for a_set in A_set}
Ad = {}
for i in A:
    if not i in Ad:
        Ad[i] = 0
    Ad[i] += 1
score_sum = sum([x * (x - 1) / 2 for x in list(Ad.values())])
for a in A:
    print((int(score_sum - (Ad[a] - 1))))

import collections

N = int(eval(input()))
A = list(map(int, input().split()))
Ad = dict(collections.Counter(A))
# A_set = list(set(A))
# Ad = {a_set:A.count(a_set) for a_set in A_set}
# Ad = {}
# for i in A:
#   if not i in Ad:
#     Ad[i]=0
#   Ad[i] += 1
score_sum = sum([x * (x - 1) / 2 for x in list(Ad.values())])
for a in A:
    print((int(score_sum - (Ad[a] - 1))))

+import collections + +Ad = dict(collections.Counter(A)) -Ad = {} -for i in A: -    if not i in Ad: -        Ad[i] = 0 -    Ad[i] += 1 +# Ad = {} +# for i in A: +#   if not i in Ad: +#     Ad[i]=0 +#   Ad[i] += 1