program sample
    implicit none
  
    integer(8) :: i,j,m,n,x,b,s
    
    integer(8):: a(1000000)
  
    read(*,*) s
    
    
    do i=1,1000000
        a(i)=0
    end do
    m=1
    do 
        if(a(s)==1)then
            exit
        else
            a(s)=a(s)+1
            m=m+1
            if (mod(s,2)==0)then
                s=s/2
            else
                s=s*3+1
            end if
        end if
                 
    end do
   
        write(*,*)m
   
    
    stop
end program sample
  

