n = gets.chomp.to_i max = n count = 0 while n != 1 do if n % 2 == 0 n /= 2 else n = 3 * n + 1 end if n > max then max = n end count += 1 end p count p max