using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using static System.Math; namespace SortItems { class Program { static void Main(string[] args) { var n = long.Parse(Console.ReadLine()); long m = n; long d = 0; // 通常の値を取得する while(m > 0) { d += m; m = m / 2; } Console.WriteLine((n * 2) - d); } } }