program main implicit none integer*4::B(1:9),i read *,B do i=1,10 if(B(i).ne.i) exit end do print '(i0)',i end program main