using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { Int64 N = Int64.Parse(Console.ReadLine()); Int64 X = 1; Int64 time = 0; if (N == 0) { Console.WriteLine(1); return; } if (N == 1) { Console.WriteLine(0); return; } while(N > X) { X = X << 1; time++; } time += X - N; Console.WriteLine(time); } } }