n = gets.not_nil!.to_i result1 = 0 result2 = n while n > 1 if n % 2 != 0 n = n * 3 + 1 else n //= 2 end result1 += 1 result2 = Math.max(result2, n) end puts result1 puts result2