using System; using System.Numerics; public static class P { public static void Main() { string ns = Console.ReadLine(); BigInteger n = 0; foreach (var c in ns) n = n * 10 + c - '0'; BigInteger res = n * 2; while (n > 0) { res -= n; n >>= 1; } Console.WriteLine(res); } }