using System; using System.Linq; using System.Numerics; public static class P { public static void Main() { string ns = Console.ReadLine(); BigInteger res = 0; BigInteger dig = 1; foreach (var c in ns.Reverse()) { if ((c - '0') % 2 != 0) res += dig; var cdig = dig; dig += cdig << 3; dig += cdig << 1; } Console.WriteLine(res.ToByteArray().Sum(x => PopCount(x))); } static int PopCount(int n) //byte { n = n - ((n >> 1) & 0b01010101); n = (n & 0b00110011) + ((n >> 2) & 0b00110011); return ((n * 0b00010001) >> 4) & 15; } }