import Data.List
import Data.Maybe

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

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