program bbb
implicit none

integer :: s, i, j, p
integer,dimension(1000000) :: a

read*, s

p=0
a=0
a(1)=s

do i=2,1000000
if(mod(a(i-1),2)==0) then
a(i)=a(i-1)/2
else
a(i)=3*a(i-1)+1
end if
p=a(i)
 do j=1,i-1
 if(p==a(j)) then
 write(*,'(i0)') i
 return
 end if
 end do
end do

end program