class CalcService
  def initialize(s)
    @s = s
    @memo = {}
  end

  def execute
    j = 1
    answer = {}
    ans = 0
    while true do
      ans = a(j)
      answer[ans] ||= []
      answer[ans] << j
      break if answer[ans].length > 1
      j += 1
    end
    puts j
  end

  def a (i)
    return @s if i == 1
    f(a(i-1))
  end

  def f (n)
    return @memo[n] if @memo.key?(n)
    if n % 2 == 0
      return n/2
    else
      return 3*n + 1
    end
  end
end
s = gets.to_i
CalcService.new(s).execute
