program example
    implicit none

    integer :: N,B=0,i=1,j=1,wa=0
    integer,allocatable :: A(:)

    read(*,*) N

    allocate(A(N-1))

    read(*,*) A

    do
        
        if(A(i)==j) then
!            write(*,*) i
            B=B+1
        end if

        wa=wa+1
        
        if(wa==N-1) then
            write(*,*) B
            B=0
            wa=0
            i=1
            j=j+1
        else
            i=i+1
        end if

        if(j>N) then
            exit
        end if

    end do


end program
