program banned_k
  implicit none
  integer :: n, a(200000) = 0, i
  integer(8) :: b(200000) = 0, x = 0
  read(*,*) n
  read(*,*) a(1:n)
  do i = 1, n
    b(a(i)) = b(a(i))+1
  end do
  do i = 1, n
    x = x+(b(i)*(b(i)-1))/2
  end do
  do i = 1, n
    write(*,'(i0)') x-(b(a(i))-1)
  end do
end program banned_k