program abc170a
   implicit none
   integer :: x(5)
   integer :: i

   read(*,*) x(:)

   do i = 1, 5
      if(x(i)==0) then
         print *, i
         stop
      endif
   enddo

end program abc170a
