
import Control.Monad.Trans.State (get, modify, evalState)
import qualified Data.Map.Strict as M

f n
  | even n = div n 2
  | odd  n = 3 * n + 1

solv s = flip evalState (M.fromList [(s,1)]) $ go 2 s where
  go i prev = do
    let next = f prev
    m <- get
    case M.lookup next m of
      Just _ -> return i
      Nothing -> do
        modify (M.insert next i)
        go (i+1) next

main = do
  s <- read <$> getLine :: IO Int
  print $ solv s
