text: import sys
  from collections import defaultdict
  
  sys.setrecursionlimit(10 ** 6)
  stdin = sys.stdin
  
  ni = lambda: int(ns())
  na = lambda: list(map(int, stdin.readline().split()))
  ns = lambda: stdin.readline().strip()
  
  def cmb(n, r):
      if n < r: return 0
      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
  
  N = ni()
  A = na()
  d = defaultdict(int)
  for a in A:
      d[a] += 1
  total = 0
  for key in d.keys():
      total += cmb(d[key], 2)
  
  for a in A:
      n = d[a]
      print(total - cmb(n, 2) + cmb(n - 1, 2))
  