object Main extends App {

  import scala.io.StdIn._
  implicit val memo = Array.tabulate(1000001){_ ⇒ -1}
  solve
  def solve: Unit = {
    val n = readLine.trim.toInt
    if (n != 0){
      println(calCollatz(n))
      solve
    }
  }
  def calCollatz(num: Int)(implicit memo: Array[Int]): Int = {
    if (num == 1) 0
    else {
      if (memo(num) < 0) {
        memo(num) = if (num % 2 == 0) 1 + calCollatz(num / 2)
        else 1 + calCollatz(num * 3 + 1)
      }
      memo(num)
    }
  }
  implicit class ScopeFunc[T](val value:T){
    def let[A](func: T ⇒ A): A = func(value)
  }
}
