program atcoder322_D
  integer(8),dimension(200000) :: A,B
  integer(8)::M
  read(5,*)N
  read(5,*)A(1:N)
  M=0
  do I=1,N
     B(A(I))=B(A(I))+1
  end do
  do I=1,N
     M=M+B(I)*(B(I)-1)/2
  end do
  do I=1,N
     write(6,*)M-(B(A(I))-1)
  end do
end program atcoder322_D