using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace YukiCoder { class Program { static void Main(string[] args) { long N = long.Parse(Console.ReadLine()); long a = N * 2; for (; N > 0; N >>= 1) { a -= N; } Console.WriteLine(a); Console.ReadLine(); } } }