import Data.List
import Data.Maybe

main = do
  s <- readLn :: IO Int
  print $ collatz s 1 [] 

collatz :: Int -> Int -> [(Int,Int)] -> Int
collatz s i xs 
  | isJust $ f s xs = i+1
  | otherwise = collatz (m s) (i+1) ((i,s):xs)
  where 
    m n = if even n then n`div`2 else 3*n+1
    f n xs = find (\x -> snd x == (m n)) xs