using System.Collections.Generic; using System; public class P { public int a { get; set; } public int times { get; set; } } public class Hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var ans = getA(n); Console.WriteLine(ans); } public static int getA (int n) { var q = new Queue
(); q.Enqueue(new P { a = n, times = 0 }); while (true) { var w = q.Dequeue(); if (w.a == 1) return w.times; if (w.a % 2 == 0) { q.Enqueue(new P { a = w.a / 2, times = w.times + 1 }); q.Enqueue(new P { a = w.a + 1, times = w.times + 1 }); } else q.Enqueue(new P { a = w.a + 1, times = w.times + 1 }); } } }