using System; using System.Collections.Generic; using System.Linq; namespace yukicode { public class Program { public static UInt64 F(UInt64 n) { return n + ( n / 2 == 0 ? 0 : F( n / 2 ) ); } public static UInt64 Solver(System.IO.TextReader reader) { var x = UInt64.Parse( reader.ReadLine() ); return x * 2 - F( x ); } private static void Main() { Console.WriteLine( Solver( Console.In ) ); } } }