while true
    n = gets.to_i
    break if n == 0
    sum = 0
    while n != 1
        r = n % 2
        if r == 0
            n /= 2
        else
            n = n * 3 + 1
        end
        sum += 1
    end
    puts sum
end

