$a = gets
 
numbers = [$a]
 
value = false

sum = 1

until value
  if $a % 2 == 0
    sum += 1
    $a = $a / 2
    numbers.each do |number|
      if number == $a
        value = true
        puts sum
      end
    end
    numbers.push($a)
  else
    sum += 1
    $a = $a * 3 + 1
    numbers.each do |number|
      if number == $a
        value = true
        puts sum
      end
    end 
    numbers.push($a)
  end
end
