object Main extends App {
  val s = io.StdIn.readLine.toInt

  def f(n: Int) = n match {
    case n if n % 2 == 0 => n / 2
    case n => 3 * n + 1
  }

  def test: Int = {
    var previous = s
    var map = Set[Int](s)

    for (i <- 2 to 1000000) {
      val ai = f(previous)
      if (map.contains(ai)) return i
      map = map + ai
      previous = ai
    }
    ???
  }

  val out = test

  println(out)
}

