using System; using System.Linq; using System.Numerics; public static class P { public static void Main() { int digCount = 19; BigInteger digit = BigInteger.Pow(10, digCount); string ns = Console.ReadLine(); ns = ns.PadLeft((ns.Length + digCount - 1) / digCount * digCount, '0'); BigInteger res = 0; BigInteger dig = 1; for (int i = 0; i < ns.Length; i += digCount) { var str = ns.Substring(ns.Length - digCount - i, digCount); res += dig * ulong.Parse(str); dig *= digit; } 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; } }