solve :: Int -> Int -> [Int] -> Int
solve current count history
  | next `elem` history = count + 1
  | otherwise = solve next (count + 1) (next:history)
    where next = if even current
                 then current `div` 2
                 else 3 * current + 1

main :: IO ()
main = do
  s <- readLn
  print $ solve s 1 [s]