main :: IO ()
main = do
    s <- fmap read getLine :: IO Int
    print $ solve s

solve :: Int -> Int
solve 1 = 4
solve 2 = 4
solve 4 = 4
solve n = 1 + (solve $ if n `mod` 2 == 0 then n `div` 2 else n * 3 + 1)
