import Control.Applicative

main = do
  s <- readLn :: IO Int
  putStr $ show $ head $ findm 0 s
  
findm :: Int -> Int -> [Int]
findm m n
  |m == 10 = []
  |(filter ((ai m n) ==) (a (m -1) n)) == [] = findm (m + 1)  n
  |otherwise = [m]

ai :: Int -> Int -> Int
ai 1 n = n
ai i n = func $ ai (i - 1) n

a :: Int -> Int ->[Int]
a i n
  |i == 0 = []
  |otherwise = [ai i n] ++ (a (i - 1) n)

func :: Int -> Int
func n
  |odd n = 3 * n + 1
  |even n = div n 2

