program main
  implicit none
  integer(8) :: n, i, counter(1:200000), pairs
  integer(8), allocatable :: a(:)
  read (*, *) n
  allocate (a(n))
  read (*, *) a(:)

  counter(:) = 0
  do i = 1, n
    counter(a(i)) = counter(a(i)) + 1
  end do

  pairs = 0
  do i = 1, 200000
    pairs = pairs + (counter(i) * (counter(i) - 1)) / 2
  end do

  do i = 1, n
    write (*, "(i0)") pairs - max(0_8, counter(a(i)) - 1)
  end do
end program main
