from sys import stdin from ctypes import * class mpz(Structure): _fields_ = [ ("_mp_alloc", c_int), ("_mp_size", c_int), ("_mp_d", POINTER(c_long)) ] def solve(): gmp = cdll.LoadLibrary("/usr/lib64/libgmp.so.10") n = mpz() gmp.__gmpz_init_set_str(byref(n), stdin.read(), c_int(10)) gmp.__gmp_printf("%d\n", gmp.__gmpz_popcount(byref(n))) solve()