program example
	implicit none

	integer :: N,i,j,k,B,wa=0
    integer,allocatable :: A(:)
    
    read(*,*) N
    
    allocate(A(N))
    
!    do i=1,N
    read(*,*) A
!    end do
    
!    write(*,*) A

    do i=1,N
    	
        B=A(i)
    	A(i)=N+1
!        write(*,*) A        
!        if(i==1) then
        
!        	do j=2,N
!            	do k=j+1,N
                
!                	if(A(j)==A(k)) then
                
!                		wa=wa+1
!                	end if
!            	end do
!            end do
            
!            write(*,*) wa
!            wa=0
            
!        else if(i/=1 .and. i/=N)  then
        
        do j=1,N
            
            do k=j+1,N
                
                if(A(j)==A(k)) then
                    
                    wa=wa+1
                end if
            end do
        end do
            
        write(*,*) wa
            
!        else if(i==N) then
!        	do j=1,N-1
!            	do k=j+1,N-1
                
!                    if(A(j)==A(k)) then
                
!                	    wa=wa+1
!                    end if
!                end do
!            end do

!            write(*,*) wa
!            wa=0
!        end if

    	A(i)=B
        wa=0
    end do

end program example
