You are a lover of bacteria. You want to raise some bacteria in a box. 

Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split into two bacteria. You hope to see exactly x bacteria in the box at some moment. 

What is the minimum number of bacteria you need to put into the box across those days?


-----Input-----

The only line containing one integer x (1 ≤ x ≤ 10^9).


-----Output-----

The only line containing one integer: the answer.


-----Examples-----
Input
5

Output
2

Input
8

Output
1



-----Note-----

For the first sample, we can add one bacterium in the box in the first day morning and at the third morning there will be 4 bacteria in the box. Now we put one more resulting 5 in the box. We added 2 bacteria in the process so the answer is 2.

For the second sample, we can put one in the first morning and in the 4-th morning there will be 8 in the box. So the answer is 1.

Difficulty: EASY

Solutions:
x = int(input())
s = 0
while x:
	s += x % 2
	x //= 2
print(s)


n = int(input())
count = 0
while n > 0:
	if n % 2 == 1:
		count += 1
	n //= 2
print(count)


n = int(input())
antwoord = 0
while n != 0:
	antwoord += n % 2
	n //= 2
print(antwoord)


n = int(input())
ans = bin(n)[2:].count('1')
print(ans)


print(sum([int(i) for i in bin(int(input())).replace('0b', '')]))


x = int(input())
ans = 0
while x > 0:
	ans += x % 2
	x //= 2
print(ans)


def f(n):
	if n == 0:
		return 0
	elif n == 1:
		return 1
	else:
		k = 1
		while True:
			if n / 2 ** k >= 2:
				k += 1
			else:
				s = k
				break
		return 1 + f(n - 2 ** s)
a = int(input())
print(f(a))


n = int(input())
kol = bin(n)[2:]
print(kol.count('1'))


x = int(input())
bacteria = 0
i = 1
while x > 0:
	if x & 1:
		bacteria += 1
	x >>= 1
print(bacteria)


x = int(input())
n = 0
while x > 0:
	n += x % 2
	x = x // 2
print(n)


a = int(input())
temp = 0
while a > 0:
	if a % 2 != 0:
		temp += 1
	a = a // 2
print(temp)


n = int(input())
s = bin(n).split('0b')
print(s[1].count('1'))


x = int(input()) * 2
count = 0
while x > 0:
	if x % 2 != 0:
		count += 1
	x //= 2
print(count)


x = int(input())
i = 0
import math

def f(x):
	global i
	if x == 0:
		return i
	if x == 1:
		return i + 1
	else:
		i += 1
		x -= 2 ** int(math.log(x, 2))
		return f(x)
print(f(x))


n = int(input())
import math
m = n
a = 0
i = 0
while m != 0:
	a = int(math.log(m, 2))
	m = m - 2 ** a
	i += 1
print(i)


x = int(input())
sol = 0
while x > 0:
	if x % 2 == 1:
		sol += 1
	x = x // 2
print(sol)


n = int(input())
nb = bin(n)
ndays = nb.count('1')
print(ndays)


n = int(input())
ans = 0
while n > 0:
	if n % 2 != 0:
		ans += 1
	n //= 2
print(ans)


n = int(input())
res = 0
while n > 0:
	(n, b) = divmod(n, 2)
	res += b
print(res)


desired_number = int(input())
bits = map(int, list(bin(desired_number)[2:]))
print(sum(bits))


x = int(input())
ret = 0
while x > 0:
	if x & 1:
		ret += 1
	x >>= 1
print(ret)


from math import *
import sys
input = sys.stdin.buffer.readline
a = int(input())
j = 1
while a > 1:
	if a % 2 == 0:
		a = a / 2
	else:
		a -= 1
		j += 1
print(j)


import math
n = int(input())
s = True
x = 0
if math.log(n, 2) % 1 == 0:
	print('1')
elif n % 2 == 0:
	while s:
		for i in range(1, 31):
			if pow(2, i) > n:
				break
		n = n - pow(2, i - 1)
		x += 1
		if n == 0:
			s = False
	print(x)
else:
	n = n - 1
	while s:
		for i in range(1, 31):
			if pow(2, i) > n:
				break
		n = n - pow(2, i - 1)
		x += 1
		if n == 0:
			s = False
	print(x + 1)


from math import log
x = int(input())
count = 1
while x != 1:
	x = x - 2 ** int(log(x, 2))
	if x == 0:
		break
	count += 1
print(count)


n = int(input())
b = bin(n)
from collections import Counter
print(Counter(b)['1'])


n = int(input())

def two_to_power(n):
	for i in range(0, n + 1):
		if 2 ** i > n:
			return int(2 ** (i - 1))
		elif 2 ** i == n:
			return int(2 ** i)
		else:
			continue
	return n

def answer(n):
	if n == 1:
		return 1
	else:
		a = n - two_to_power(n)
		if a == 0:
			return 1
		else:
			return int(1 + answer(a))
print(answer(n))


n = int(input())
ans = 0
while n > 0:
	c = 1
	while c * 2 <= n:
		c *= 2
	n -= c
	ans += 1
print(ans)


print(str(bin(int(input())))[2:].count('1'))


n = int(input())
c = 0
while n:
	n = n & n - 1
	c += 1
print(c)


def main():
	x = int(sys.stdin.readline())
	n = 0
	while x:
		if x & 1:
			n += 1
		x >>= 1
	sys.stdout.write(str(n))
import sys
main()


s = int(input())
t = 0
while s != 1:
	if s % 2 == 1:
		t += 1
		s = s - 1
	if s % 2 == 0:
		s = s // 2
if s == 1:
	print(t + 1)


n = int(input())
res = 0
while n > 0:
	n = n & n - 1
	res += 1
print(res)


x = int(input())
print(bin(x)[2:].count('1'))


x = int(input())
cont = 0
while x != 1:
	if x % 2 == 0:
		x = x / 2
	else:
		x = x - 1
		cont += 1
print(cont + 1)


x = int(input())
d = 0
while x != 0:
	d += 1
	t = 1
	while t <= x:
		t *= 2
	t /= 2
	x = x - t
print(d)


bacteria = int(input())
binary = '{0:b}'.format(bacteria)
hoge = binary.replace('0', '')
print(len(hoge))


x = int(input())
b = 1
print(bin(x).count('1'))


x = int(input())
kol = 0
while x > 0:
	a = x % 2
	kol = kol + a
	x = x // 2
print(kol)


x = int(input())
k = 0
while x != 1:
	if x % 2 == 1:
		k += 1
		x = (x - 1) // 2
	else:
		x //= 2
print(k + 1)


import math
n = int(input())
c = 0
while n != 0:
	a = int(math.log2(n))
	if a == 0:
		break
	else:
		c += 1
		n -= pow(2, a)
print(c + n)


def main():
	print(bin(int(input())).count('1'))
main()


n = int(input())
ans = 0
while n > 0:
	ans += n % 2
	n //= 2
print(ans)


n = int(input())
l = bin(n)[2:]
print(str(l.count('1')))


import math
x = int(input())
s = 0
while x > 0:
	l = math.log2(x)
	if int(l) == l:
		s += 1
		x = 0
	else:
		x = x - 2 ** int(l)
		s += 1
print(s)


n = int(input())
ans = 0
while n > 0:
	ans += n & 1
	n >>= 1
print(ans)


n = int(input())
x = 0
while n >= 1:
	if n % 2 == 1:
		x += 1
		n -= 1
	else:
		n /= 2
print(x)


def bacteria(n):
	bacs = 0
	for i in range(31):
		if 1 << i & n:
			bacs += 1
	return bacs
print(bacteria(int(input())))


n = int(input())
s = 0
while n > 0:
	s = s + n % 2
	n = n // 2
print(s)


x = int(input())
ctr = 0
while x > 0:
	if x % 2 == 0:
		x = x / 2
	else:
		x = x // 2
		ctr += 1
print(ctr)


x = int(input())
a = 0
while x:
	if x % 2:
		x -= 1
		a += 1
	else:
		x //= 2
print(a)


a = int(input())
i = 0
while a != 0:
	while a % 2 == 0:
		a /= 2
	else:
		a -= 1
		i += 1
print(i)


n = int(input())
t = 0
c = 1
while n / 2 ** c > 1:
	c += 1
while c >= 0:
	t += n // 2 ** c
	n = n % 2 ** c
	c -= 1
print(t)


a = int(input())
ans = 0
while a != 0:
	c = a % 2
	ans = ans + c
	a = a // 2
print(ans)


x = int(input())
ans = 0
while x:
	if x & 1:
		ans += 1
	x = x >> 1
print(ans)


from math import log2
x = int(input())
raw = x
s = 0
while x > 0:
	s += x % 2
	x = x / 2
print(round(s / 2))


x = int(input())
p = 0
while x > 0:
	i = 0
	while 2 ** i <= x:
		i += 1
	if 2 ** i > x:
		i -= 1
	x -= 2 ** i
	p += 1
print(p)


n = int(input())
total = 0
for i in range(30, -1, -1):
	x = n // 2 ** i
	total += x
	n -= x * 2 ** i
print(total)


n = int(input())
counter = 0
for i in range(40, -1, -1):
	if n - 2 ** i >= 0:
		n -= 2 ** i
		counter += 1
print(counter)


n = int(input())
add = 0
while n != 0:
	if n % 2 == 0:
		n //= 2
	else:
		n //= 2
		add += 1
print(add)


a = int(input())
print(bin(a)[2:].count('1'))


n = int(input())
days = 0
while n > 0:
	if n % 2 == 1:
		days += 1
	n //= 2
print(days)


corona = int(input())
if corona == 1:
	print(1)
	exit()
i = 1
covid = 0
while True:
	if corona == 2 ** i:
		covid += 1
		break
	if corona < 2 ** i:
		corona -= 2 ** (i - 1)
		covid += 1
		i = 0
	if corona == 1:
		covid += 1
		break
	i += 1
print(covid)


x = int(input())
sum = 0
while x != 0:
	if x & 1 == 1:
		sum += 1
	x = x >> 1
print(sum)


a = 0
x = int(input())
if x % 2 != 0:
	a += 1
for z in range(100):
	x = x // 2
	if x < 0:
		break
	if x % 2 != 0:
		a += 1
print(a)


x = int(input())
i = 0
while x > 0:
	last = x % 2
	x = x // 2
	i = i + last
print(i)


def decimalToBinary(N):
	B_Number = 0
	cnt = 0
	while N != 0:
		rem = N % 2
		c = pow(10, cnt)
		B_Number += rem * c
		N //= 2
		cnt += 1
	return B_Number
N = int(input())
z = decimalToBinary(N)
s = str(z)
l = []
for i in s:
	l.append(i)
print(l.count('1'))


n = int(input())
print(bin(n).count('1'))


bak = int(input())
target = 0
hui = 0
while bak > 0:
	target = bak % 2
	bak = bak // 2
	if target > 0:
		hui = hui + 1
print(hui)


n = int(input())
c = 0
while n >= 1:
	if n % 2 == 1:
		c = c + 1
		n = n - 1
	else:
		n = n / 2
print(c)


n = int(input())
count = 1
while n & n - 1 != 0:
	n = n & n - 1
	count += 1
print(count)


import sys
n = int(input())
if n == 0:
	print(0)
	sys.exit()
i = 1
b = 1
while i <= n:
	if i == n:
		break
	elif i * 2 > n:
		n = n - i
		b += 1
		i = 1
	else:
		i = i * 2
print(b)


def DecToBin(n):
	n = int(n)
	if n == 0:
		return 0
	else:
		result = []
		while n != 0:
			result.append(str(n % 2))
			n = n // 2
		result.reverse()
		return ''.join(result)
n = input()
d = DecToBin(n)
print(d.count('1'))


import math
x = int(input())
total = 0
while True:
	if x == 0:
		break
	else:
		x -= 2 ** int(math.log(x, 2))
		total += 1
print(total)


x = int(input())
e = 0
if x == 1:
	print(1)
	exit()
if x % 2 != 0:
	e += 1
	x -= 1
while True:
	x = x / 2
	if x % 2 == 0:
		continue
	elif x == 1:
		e += 1
		print(e)
		exit()
	else:
		e += 1
		x -= 1
		continue


i = 0
a = int(input())
while a != 0:
	if a % 2 == 1:
		i = i + 1
	a = a // 2
print(i)


bacteria = int(input())

def myfunc(x):
	a = 0
	counter = 1
	while x - 2 ** a != 0:
		a += 1
		if 2 ** a > x:
			x -= 2 ** (a - 1)
			a = 0
			counter += 1
	if x - 2 ** a == 0:
		return counter
print(myfunc(bacteria))


string = bin(int(input()))
print(string.count('1'))


x = int(input())
binx = bin(x)
line = [i for i in binx]
line = line[2:]
output = 0
for i in line:
	if i == '1':
		output += 1
print(output)


n = int(input())
m = 0
while n > 0:
	if n % 2 == 1:
		m += 1
		n -= 1
	else:
		n //= 2
print(m)


import sys
n = int(input())
print(bin(n).count('1'))


a = int(input())
b = bin(a).replace('0b', '')
print(b.count('1'))


n = 1
p = int(input())
l = [1]
r = 0
O = 0
while n < 1000000000:
	n = n * 2
	l.append(n)
while p != 0:
	for i in range(len(l)):
		if p < l[i]:
			r = l[i - 1]
			O += 1
			p = p - r
			r = 0
			break
		elif p == l[i]:
			r = l[i]
			O += 1
			p = p - r
			r = 0
			break
print(O)


n = bin(int(input()))
print(sum([i == '1' for i in list(n)]))


n = int(input())
b = 0
while n // 2 != 0:
	b += n % 2
	n = n // 2
print(b + 1)


x = int(input())
base = [2 ** i for i in range(31)]
base.sort(reverse=True)
t = 0
while x > 0:
	for i in base:
		if x >= i:
			break
	x = x - i
	t = t + 1
print(t)


n = int(input())
l = []
while n > 1:
	q = n % 2
	l.append(q)
	n = n // 2
if n <= 1:
	l.append(n)
print(l.count(1))


x = int(input())
r = 0
while x:
	r += x & 1
	x >>= 1
print(r)


t = int(input())
d = bin(t)
print(d.count('1'))


import sys
n = int(sys.stdin.readline().split()[0])
a = str(bin(n))
x = 0
for i in a:
	if i == '1':
		x += 1
print(x)


x = int(input())

def solve(n):
	count = 0
	while n > 0:
		count += n & 1
		n >>= 1
	print(count)
solve(x)


x = int(input())
i = 1
while x > 1:
	if x % 2 == 0:
		x = x // 2
	else:
		x = x - 1
		i = i + 1
print(i)


s = input()
s = int(s)
count = 0
for i in range(10000):
	if not s == 1:
		if s % 2 == 1:
			s = (s - 1) / 2
			count = count + 1
		else:
			s = s / 2
	else:
		break
print(count + 1)


n = int(input())
print(sum([int(i) for i in list(bin(n).replace('0b', ''))]))


N = int(input())
n = N
c = 0
while n > 0:
	if n & 1:
		c += 1
	n = n >> 1
print(c)


a = str(bin(int(input())))
print(a.count('1'))


a = int(input())
b = bin(a)
l = []
for x in range(2, len(b)):
	l.append(b[x])
c = 0
for x in l:
	c += int(x)
print(c)


x = int(input())
bacteria = 0
while x > 0:
	if x % 2 == 1:
		x -= 1
		bacteria += 1
	x //= 2
print(bacteria)


n = int(input())
c = 0

def decToBinary(n):
	s = ''
	for i in range(31, -1, -1):
		k = n >> i
		if k & 1:
			s += '1'
		else:
			s += '0'
	return s
for i in decToBinary(n):
	if i == '1':
		c += 1
print(c)


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
answer = 0
while n > 0:
	answer += n % 2
	n = n // 2
print(answer)


a = int(input())
a *= 2
b = 0
a //= 2
while a != 0:
	b += a % 2
	a //= 2
print(b)


a = int(input())
b = bin(a)
c = str(b)
sum = 0
for i in c:
	if i == '1':
		sum = sum + 1
	else:
		pass
print(sum)


n = int(input())

def main(n):
	binary = bin(n)
	binary = list(binary)
	print(binary.count('1'))
main(n)


def decimalToBinary(n):
	return bin(n).replace('0b', '')
x = int(input())
sum = 0
ele = decimalToBinary(x)
for i in ele:
	if i is '1':
		sum += 1
print(sum)


x = str(bin(int(input())))
print(x.count('1'))


x = int(input())
i = 0

def find(a, n):
	if a == 1:
		return 2 ** n
	else:
		return find(a // 2, n + 1)
while True:
	x = x - find(x, 0)
	i = i + 1
	if x == 0:
		break
print(i)


x = int(input())
num = 0
array = [536870912, 268435456, 134217728, 67108864, 33554432, 16777216, 8388608, 4194304, 2097152, 1048576, 524288, 262144, 131072, 65536, 32768, 16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32, 16, 8, 4, 2]
while x > 1:
	for i in array:
		if i <= x:
			x -= i
			num += 1
print(num + x)


bac = int(input())

def rua(a, tt=0):
	while a != 0:
		for i in range(9999):
			if 2 ** i > a:
				b = a // 2 ** (i - 1)
				tt += b
				a -= b * 2 ** (i - 1)
				return rua(a, tt)
				break
	else:
		print(tt)
rua(bac)


n = int(input())
b = '{0:b}'.format(n)
count = 0
for x in b:
	if x == '1':
		count = count + 1
print(count)


__author__ = 'Rakshak.R.Hegde'
x = int(input())
c = 1
while x:
	x = x - 2 ** (x.bit_length() - 1)
	if x:
		c += 1
print(c)


import sys
input = sys.stdin.readline
s = bin(int(input()))[2:]
out = 0
for i in s:
	if i == '1':
		out += 1
print(out)


print(f'{int(input()):b}'.count('1'))


x = int(input())
suma = 0
while x > 0:
	last = x % 2
	suma = suma + last
	x = x // 2
print(suma)


n = int(input())
c = 0
while n > 0:
	r = n % 2
	c = c + r
	n = n // 2
print(c)


n = int(input())
(bis, ans) = (1 << 32, 0)
while bis != 0:
	if n & bis != 0:
		ans += 1
	bis >>= 1
print(ans)


b = int(input())
x = 0
i = 0
mult = []
total = 0
while x <= 1000000000:
	x = pow(2, i)
	i += 1
	mult.append(x)
restmin = 100000000000
if b in mult:
	print(1)
else:
	i = len(mult) - 1
	while b != 0:
		if b >= mult[i]:
			total += 1
			b = b - mult[i]
			i = len(mult) - 1
		else:
			i -= 1
	print(total)


n = int(input())
count = 0
while n != 0:
	count += int(n % 2)
	n //= 2
print(count)


import sys
x = int(sys.stdin.readline())
a = 0
while x > 0:
	a += x % 2
	x = x >> 1
print(a)


num = int(input())
ans = 0
while num > 1:
	temp = num % 2
	ans += temp
	num = int(num / 2)
print(ans + 1)


import math
__author__ = 'Obriel Muga'

def raising_bacteria(x):
	binario = '{0:b}'.format(x)
	num = 0
	for i in binario:
		if i == '1':
			num = num + 1
	return num
x = int(input())
print(raising_bacteria(x))


def split_bacteria(x, step):
	temp = x
	while temp > 1:
		if temp % 2 == 0:
			temp /= 2
		else:
			step += 1
			split_bacteria(int(temp - 1), step)
			break
	if temp == 1:
		print(step)
x = int(input())
split_bacteria(x, 1)


import math as m
n = int(input())
k = m.log2(n)
l = [0] * (int(k) + 1)
while n != 0:
	a = m.log2(n)
	a = int(a)
	l[len(l) - a - 1] = 1
	n = n - 2 ** int(a)
print(l.count(1))


x = int(input())
res = 0
while x:
	while x % 2 == 0:
		x /= 2
	x -= 1
	res += 1
print(res)


n = int(input())
minus = 0
while n != 0:
	if n % 2 == 0:
		n //= 2
	else:
		n -= 1
		minus += 1
if minus == 0:
	print(1)
else:
	print(minus)


x = int(input())
c = 0
while x > 0:
	c = c + x % 2
	x = x // 2
print(c)


import unittest
import sys

class Bacteria:

	def __init__(self, test_inputs=None):
		it = iter(test_inputs.split('\n')) if test_inputs else None

		def uinput():
			return next(it) if it else sys.stdin.readline().rstrip()
		[self.n] = map(int, uinput().split())

	def calculate(self):
		result = 1
		cur = self.n
		while cur != 1:
			if cur % 2:
				result += 1
				cur -= 1
			while not cur % 2:
				cur //= 2
		return str(result)

class unitTests(unittest.TestCase):

	def test_single_test(self):
		test = '5'
		d = Bacteria(test)
		self.assertEqual(d.n, 5)
		self.assertEqual(Bacteria(test).calculate(), '2')
		test = '8'
		self.assertEqual(Bacteria(test).calculate(), '1')
		test = '1'
		self.assertEqual(Bacteria(test).calculate(), '1')
		test = '343000816'
		self.assertEqual(Bacteria(test).calculate(), '14')

	def time_limit_test(self, nmax):
		import random
		import timeit
		test = str(nmax) + ' ' + str(nmax) + '\n'
		numnums = [str(i) + ' ' + str(i + 1) for i in range(nmax)]
		test += '\n'.join(numnums) + '\n'
		nums = [random.randint(1, 10000) for i in range(nmax)]
		test += ' '.join(map(str, nums)) + '\n'
		start = timeit.default_timer()
		d = Bacteria(test)
		calc = timeit.default_timer()
		d.calculate()
		stop = timeit.default_timer()
		print('\nTimelimit Test: ' + '{0:.3f}s (init {1:.3f}s calc {2:.3f}s)'.format(stop - start, calc - start, stop - calc))
sys.setrecursionlimit(100000)
if sys.argv[-1] == '-ut':
	unittest.main(argv=[' '])
sys.stdout.write(Bacteria().calculate())


print(sum(map(int, list(format(int(input()), 'b')))))


import math as m
x = int(input())
s = str(bin(x))
print(s[2:].count('1'))


X = bin(int(input()))[2:]
print(list(X).count('1'))


x = int(input())
str_bin_x = str(bin(x))
str_bin_x[2:]
i = 0
for element in str_bin_x:
	if element == '1':
		i += 1
print(i)


num = int(input())
ans = [int(i) for i in bin(num)[2:]]
sum = 0
for i in ans:
	sum += i
print(str(sum))


n = int(input())
s = bin(n)
s = s[2:]
s = list(s)
o = s.count('1')
print(o)


def fun(x):
	i = 1
	while i * 2 <= x:
		i *= 2
	return i
a = int(input())
i = 0
while a != 0:
	a = a - fun(a)
	i += 1
print(i)


n = int(input())
l_2 = []
i = 0
result = 0
while 2 ** i <= n:
	l_2 += [2 ** i]
	i += 1
l_2.reverse()
while n > 0:
	for t in l_2:
		if t <= n:
			result += n // t
			n -= n // t * t
print(result)


n = int(input())
res = [i for i in str(bin(n).replace('0b', ''))]
r = 0
for i in res:
	if i == '1':
		r += 1
print(r)


x = int(input())
y = 0
z = 0
for _ in range(30):
	if x % 2 != 0 and x > 0:
		z += 1
	x = x // 2
print(z)


n = int(input())
ans = 0
for i in range(31, -1, -1):
	if 1 << i & n:
		ans += 1
print(ans)


import sys
import random
from math import log2, log, ceil
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, size, link):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().split()))
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
print(bin(n).count('1'))


a = int(input())
sum1 = 0
if a == 0:
	print(0)
elif a & a - 1 == 0:
	print(1)
else:
	while a:
		if a % 2 == 0:
			a /= 2
		elif a % 2 != 0:
			sum1 += 1
			a -= 1
	print(sum1)


bacteria = int(input())

def two_powers(bacteria):
	bac_repr = []
	while bacteria != 0:
		bac_repr.append(bacteria & -bacteria)
		bacteria = bacteria & bacteria - 1
	return bac_repr
res = two_powers(bacteria)
print(len(res))


w = int(input())
a = 1
while w != 1:
	if w % 2 == 0:
		w //= 2
	else:
		w -= 1
		a += 1
print(a)


a = int(input())
b = 0
c = 0
d = 0
while c != 1:
	if a > 2 ** (b + 1):
		b = b + 1
	elif a == 2 ** (b + 1) or a == 2 ** b:
		c = c + 1
		d = d + 1
	else:
		a = a - 2 ** b
		b = 0
		d = d + 1
print(d)


def count_bits(v):
	if v == 0:
		return 0
	else:
		return v % 2 + count_bits(v // 2)
print(count_bits(int(input())))


import itertools as ittls
from collections import Counter
import string

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
N = int(input())
print(sum(map(int, bin(N)[2:])))


n = int(input())
ans = []
while n >= 1:
	ans.append(n % 2)
	n = n // 2
print(sum(ans))


x = int(input())
n = 0
t = 0
while 2 ** n < x:
	n = n + 1
if 2 ** n == x:
	print(1)
else:
	t = 1
	a = x - 2 ** (n - 1)
	while a >= 1:
		b = 0
		while 2 ** b < a:
			b = b + 1
		if 2 ** b == a:
			t = t + 1
			a = 0
		else:
			a = a - 2 ** (b - 1)
			t = t + 1
	if a == 1:
		t = t + 1
	print(t)


import math
X = int(input())

def main(X):
	count = 1
	while X > 1:
		if X % 2 == 0:
			X = X / 2
		else:
			X = X - 1
			count = count + 1
	return count
print(main(X))


n = int(input())
t = 0
while n > 0:
	t += n % 2
	n //= 2
print(t)


x = int(input())
count = 0
w = 0
tot = 0
while x >= 1:
	if x % 2 == 1:
		count += 1
		x = x - 1
	else:
		x = x / 2
print(count)


n = int(input())
temp = 0
while n >= 1:
	if n % 2 == 0:
		n = n // 2
	else:
		n = n - 1
		temp = temp + 1
print(temp)


n = int(input())
s = ''
while n > 0:
	s += str(n % 2)
	n //= 2
print(s.count('1'))


x = int(input())
count = 0
while x > 0:
	count += x % 2
	x = x // 2
print(count)


n = int(input())
count = 0
i = 1
if n == 1:
	print(1)
else:
	while n != 0:
		power = 1 << i
		if power >= n:
			count += 1
			if power > n:
				power = power >> 1
				n -= power
			else:
				n -= power
			i = 1
		else:
			i += 1
	print(count)


x = int(input())
import math
s = 0
e = 0
while x > 0:
	e = int(math.log(x, 2))
	x -= 2 ** e
	s += 1
print(s)


n = int(input())
ans = 1
i = 0
while n // 2 ** i != 0:
	i += 1
	if n // 2 ** i == 1:
		if n % 2 ** i == 0:
			break
		ans += 1
		n = n % 2 ** i
		i = 0
print(ans)


n = bin(int(input()))
A = [str(i) for i in str(n)]
print(A.count('1'))


bacteria_num = int(input())
sum = 0
while bacteria_num:
	sum += bacteria_num & 1
	bacteria_num = bacteria_num >> 1
print(sum)


bacteria = int(input())
lista = []
while bacteria != 0:
	reciduo = bacteria % 2
	bacteria = bacteria // 2
	lista.insert(0, reciduo)
a = 0
for x in lista:
	a += x
print(a)


x = int(input())
count = 0
while x > 0:
	if x & 1:
		count += 1
	x >>= 1
print(count, end='')


y = input()
n = int(y)
aa = int(n)
dd = 0
while aa > 0:
	if aa % 2 != 0:
		dd = dd + 1
	aa = int(aa / 2)
print(dd)


l = str(bin(int(input()))).replace('0b', '')
sum = 0
for s in l:
	sum += int(s)
print(sum)


x = int(input())
k = str(bin(x))
print(str(k.count('1', 2)))


def solve(n):
	count = 0
	while n > 0:
		count += n & 1
		n >>= 1
	return count
n = int(input())
print(solve(n))


n = int(input())
q = 0
while n > 1:
	if n % 2 == 0:
		n = n // 2
	else:
		q += 1
		n = (n - 1) // 2
print(q + 1)


N = bin(int(input()))
cnt = 0
for i in range(2, len(N)):
	if N[i] == '1':
		cnt += 1
print(cnt)


aa = int(input())
ans = 0
while aa > 0:
	ans += 1
	bb = 1
	while bb * 2 <= aa:
		bb *= 2
	aa -= bb
print(ans)


n = int(input())
(p, c) = (0, 0)
while True:
	a = 2 ** p
	if a > n:
		c += 1
		n = n - a // 2
		p = 0
	elif n <= 0 or a == n:
		c += 1
		break
	else:
		p += 1
print(c)


import sys

def bits(n: int):
	return list(bin(n)).count('1')

def main(test_case=False):
	n = int(input()) if test_case else 1
	for _ in range(n):
		test()

def flush():
	sys.stdout.flush()

def parr(arr):
	print(*arr, sep=' ')

def gcd(a, b):
	while b:
		if b % a == 0:
			break
		tmp = a
		a = b % a
		b = tmp
	return a

def test():
	print(bits(int(input())))
main(False)


from math import log
count = 0
N = int(input())
while log(N, 2) >= 1:
	count += 1
	Ans = log(N, 2)
	N -= pow(2, int(Ans))
	if N == 0:
		print(count)
		exit()
print(count + 1)


n = int(input())
s = str(bin(n))[2:]
ans = 0
for i in s:
	if i == '1':
		ans += 1
print(ans)


x = bin(int(input()))
x = x[2:len(x)]
ans = 0
for n in x:
	if n == '1':
		ans += 1
print(ans)


x = int(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')
ans = decimalToBinary(x)
print(ans.count('1'))


n = int(input())
out = 1
while n > 1:
	if n % 2 == 1:
		out += 1
		n -= 1
	n = n // 2
print(out)


n = int(input())
s = 0
while n > 0:
	if n % 2 == 1:
		n -= 1
		s += 1
	else:
		n //= 2
print(s)


def cb(n, i):
	return bool(n & 1 << i)
n = int(input())
c = 0
for i in range(32):
	if cb(n, i) == True:
		c = c + 1
print(c)


k = bin(int(input()))
print(k.count('1'))


x = int(input())
ans = 0
while x // 2 != 0:
	if x % 2 == 0:
		x = x // 2
	else:
		ans += 1
		x = x // 2
print(ans + 1)


x = int(input())
ans = 0
x = bin(x).lstrip('0b')
for digit in x:
	if digit == '1':
		ans += 1
print(ans)


from bisect import bisect_right as br
import sys
from collections import *
from math import *
import re

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	c = 0
	for i in range(2, n):
		if prime[i]:
			c += 1
	return c

def iseven(n):
	return [False, True][0 if n % 2 else 1]

def inp_arr():
	return list(map(int, input().split()))

def inp():
	return map(int, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
max_int = sys.maxsize
mod = 10 ** 9 + 7
n = int(input())
print(bin(n)[2:].count('1'))


n = int(input())
binary = bin(n)
binary = binary[2:]
count = 0
for i in range(len(binary)):
	if binary[i] == '1':
		count += 1
print(count)


x = int(input())
bacteria = 0
while x > 0:
	k = 0
	while 2 ** k <= x:
		k += 1
	k -= 1
	x = x - 2 ** k
	bacteria += 1
print(bacteria)


a = int(input())
a = bin(a)
a = a[2:]
print(sum((int(i) for i in a)))


x = int(input().strip())
(ans, msk) = (0, 1)
while msk != 2 ** 30:
	if msk & x:
		ans += 1
	msk <<= 1
print(ans)


x = int(input())
v = 0
while x > 0:
	if x % 2 != 0:
		v = v + 1
	x = x // 2
print(v)


def ans(n):
	num = 0
	while n:
		if n & 1:
			num += 1
		n >>= 1
	return num
n = int(input())
print(ans(n))


print('{0:b}'.format(int(input())).count('1'))


x = int(input())
a = 1
while True:
	if x > 1:
		if x % 2 == 1:
			x -= 1
			a += 1
		x = x // 2
	if x == 1:
		print(a)
		break


n = int(input())
i = 0
noi = 0
while n > 0:
	i = 0
	while 2 ** i <= n:
		i += 1
	n = n - 2 ** (i - 1)
	noi += 1
print(noi)


x = int(input())
print(sum(map(int, str(bin(x))[2:])))


n = int(input())
c = 0
a = 1
while n != 0:
	while n >= a:
		a *= 2
	n -= a / 2
	a = 1
	c += 1
print(c)


import math

def is_power2(n):
	return bool(n and (not n & n - 1))

def closest_power2(n):
	return int(math.log2(n))
n = int(input())
print(bin(n).count('1'))


n = int(input())
s = str(bin(n))
s = s[2:]
i = x = 0
l = len(s)
while i < l:
	if s[i] == '1':
		x += 1
	i += 1
print(x)


x = int(input())
c = 0
while x > 0:
	if x % 2 == 1:
		c += 1
	x = x // 2
print(c)


import sys
import math
input = sys.stdin.readline
x = int(input().strip())
ans = 0
while x:
	if x % 2:
		ans += 1
	x //= 2
print(ans)


import math
n = int(input())
for j in range(1, 100):
	k = math.log(n, 2)
	l = int(k)
	u = k - l
	if u != 0:
		n = n - 2 ** l
		if n == 0:
			print(j)
			break
	else:
		print(j)
		break


from sys import stdin
x = int(stdin.readline().rstrip())
a = 1
while x > 1:
	a += x % 2
	x //= 2
print(a)


n = int(input())
if n == 1 or n == 2:
	print('1')
else:
	count = 0
	while n != 2:
		if n % 2 == 0:
			n = n // 2
		else:
			n = n - 1
			count += 1
	print(count + 1)


import math
d = int(input())
c = 0
while d != 0:
	d -= 2 ** int(math.log2(d))
	c += 1
print(c)


x = int(input())
a = ''
while x > 0:
	last = x % 2
	a += str(last)
	x = x // 2
print(str(a).count('1'))


n = int(input())
t = 0
ans = 0
if n == 1 or n == 2:
	print(1)
	exit()
for i in range(n):
	if 2 ** i > n:
		t = i
		break
while t >= 0:
	if n - 2 ** t >= 0:
		n -= 2 ** t
		ans += 1
	if n == 0:
		print(ans)
		exit()
	t -= 1


print(sum(map(int, f'{int(input()):b}')))


x = int(input())
count = 0
while x:
	x &= x - 1
	count += 1
print(count)


n = int(input())
a = 0
while n > 0:
	for i in range(0, 1000):
		if 2 ** i > n:
			break
	n = n - 2 ** (i - 1)
	a = a + 1
print(a)


import math
n = int(input())
k = n
no = math.log2(n)
if no == math.floor(no):
	print('1')
else:
	count = 1
	while n - 2 ** math.floor(math.log2(n)) > 1:
		n -= 2 ** math.floor(math.log2(n))
		if n == 0:
			break
		count += 1
	if k % 2 == 0:
		print(count)
	else:
		print(count + 1)


n = int(input())
s = bin(n)
s = s[2:]
res = s.count('1')
print(res)


n = int(input())
cnt = 0
while n >= 1:
	if n % 2 == 0:
		n /= 2
	else:
		cnt += 1
		n -= 1
print(cnt)


bits = list((int(i) for i in str(bin(int(input())))[2:]))
print(sum(bits))


x = int(input())
c = 0
pendiente = True
while pendiente:
	for a in range(100):
		if 2 ** a > x:
			q = 2 ** (a - 1)
			c += 1
			break
	x -= q
	if x == 0:
		pendiente = False
print(c)


n = int(input())
test = None
bacteria = 0
while test is None:
	if n == 1:
		bacteria += 1
		break
	elif n % 2 == 0:
		n = n / 2
	elif n % 2 == 1:
		n = n - 1
		bacteria += 1
print(bacteria)


n = int(input())
x = 0

def bacteria(n):
	global x
	while n % 2 == 0 and n > 1:
		n = n / 2
	if n % 2 == 1 and n > 1:
		n = n - 1
		x = x + 1
		bacteria(n)
	elif n == 1:
		x = x + 1
		print(x)
bacteria(n)


n = int(input())
x = list(bin(n))
mas = x[2:]
print(mas.count('1'))


n = int(input())
bin_x = bin(n)
s = str(bin_x)
count = 0
for i in range(0, len(s)):
	if s[i] == '1':
		count += 1
print(count)


from sys import *

def solve(n):
	c = 0
	while n > 0:
		if n % 2 == 1:
			c += 1
		n = n // 2
	print(c)
	pass
test = 1
for t in range(0, test):
	n = int(input())
	ans = solve(n)


n = int(input())
res = 0
while n != 0:
	if n % 2 == 1:
		res += 1
		n -= 1
	else:
		n //= 2
print(res)


def sum_digits(n):
	r = 0
	while n:
		(r, n) = (r + n % 10, n // 10)
	return r
n = int(input())
k = bin(n)
k = k[2:]
k = sum_digits(int(k))
print(k)


n = int(input())
res = 0
while n:
	res += n % 2
	n //= 2
print(res)


n = int(input())
s1 = bin(n)[2:]
c1 = s1.count('1')
print(c1)


d = {1: 1}
x = int(input())
total = 0
while x != 0:
	if x % 2 == 0:
		x = x // 2
	else:
		x = x - 1
		total += 1
print(total)


n = int(input())
n = str(bin(n)[2:])
cnt = 0
for i in n:
	if i == '1':
		cnt += 1
print(cnt)


x = int(input())
b = bin(x)
count = 0
for ch in b[2:]:
	if ch == '1':
		count += 1
print(count)


n = int(input())
b = bin(n)
b = b[2:]
l = list((x for x in b))
print(l.count('1'))


def power(a, b):
	if b == 1:
		m = a
	elif b == 0:
		m = 1
	elif b % 2 == 0:
		m = power(a * a, b // 2)
	else:
		m = a * power(a * a, (b - 1) // 2)
	return m

def find_bacteria(n):
	ans = power(2, 1)
	i = 1
	while ans < n:
		i += 1
		ans = power(2, i)
	if ans > n:
		ans = power(2, i - 1)
	return ans
n = int(input())
nr = 0
while n > 1:
	p = find_bacteria(n)
	n = n - p
	nr += 1
if n == 1:
	nr += 1
print(nr)


from sys import stdin, stdout
input = stdin.readline
x = int(input())
a = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912]

def f(n):
	for i in range(30):
		if a[i] > n:
			i -= 1
			break
	return i
ans = 0
while x:
	x -= a[f(x)]
	ans += 1
stdout.write(str(ans))


n = int(input())
a = []
while n > 1:
	i = n % 2
	n = n // 2
	if i == 1:
		a.append(i)
print(len(a) + 1)


from collections import Counter

def calculate(expected_bac):
	bin_num = '{0:b}'.format(expected_bac)
	counter = Counter(bin_num)
	return counter.get('1', 0)
expected_bac = int(input())
input_bac = calculate(expected_bac)
print(input_bac)


n = int(input())
sum = 0
while n > 0:
	if n % 2 == 1:
		sum += 1
	n = n // 2
print(sum)


import math
n = int(input())
n = int(n)
count = 0
days = 0
while n > 0:
	if n % 2 == 0:
		n = n // 2
	else:
		n = (n - 1) // 2
		days += 1
print(days)


import math
cnt = 0
target = int(input().strip())
while target > 1:
	cnt += target % 2
	target = math.floor(target / 2)
print(cnt + 1)


from sys import *
import math

def bact(n):
	x = n
	i = 1
	while x > 1:
		x = x - int(math.pow(2, int(math.log(x, 2))))
		if x != 0:
			i = i + 1
	return i
n = int(input())
print(bact(n))


x = int(input())
result = 0
tmp = 1000000
while x != 0:
	for i in range(tmp):
		if x < 2 ** i:
			result += 1
			x -= 2 ** (i - 1)
			tmp = i
			break
print(result)


remain = int(input())
nl = []
while remain >= 2:
	n = remain % 2
	remain = remain // 2
	nl.append(n)
nl.append(remain)
print(sum(nl))


x = int(input())
b = bin(x)
count = 0
for i in range(2, len(b), 1):
	if b[i] == '1':
		count += 1
print(count)


i = int(input())
num = 1
while i > 2:
	i = i / 2
	if i > int(i):
		num = num + 1
		i = int(i)
print(num)


a = int(input())
q = 0
while a > 0:
	q = q + a % 2
	a = a // 2
print(q)


def main():
	(n, res) = (int(input()), 0)
	while n:
		res += n & 1
		n >>= 1
	print(res)
main()


number = int(input())
import math
bac = 0
day = 0
for i in range(int(math.log2(number)), -1, -1):
	number -= 2 ** i
	if number < 0:
		number += 2 ** i
	else:
		bac += 1
print(bac)


import sys
input = sys.stdin.readline
from math import log
n = int(input())
n = bin(n)[2:]
c = 0
for i in n:
	if i == '1':
		c += 1
print(c)


def main():
	from math import floor, log2
	n = int(input())
	n_bacteria = 0
	while n > 0:
		n -= 2 ** floor(log2(n))
		n_bacteria += 1
	print(n_bacteria)
main()


t = int(input())
q = 0
while t > 0:
	if t & 1 == 1:
		q += 1
	t >>= 1
print(q)


x = int(input())
bak = 0
while x > 0:
	last = x % 2
	if last == 1:
		bak += 1
	x = x // 2
print(bak)


n = int(input())
st = [2 ** j for j in range(1, 1001)]
s = 0
while n > 0:
	for i in st:
		if i > n:
			n -= i // 2
			s += 1
			break
print(s)


n = int(input())
b = ''
ans = 0
while n > 0:
	b = str(n % 2) + b
	n = n // 2
for i in range(len(b)):
	if b[i] != '0':
		ans += 1
print(ans)


n = int(input())
res = bin(n)
res = res[2:]
count = 0
for i in res:
	if i == '1':
		count += 1
print(count)


from math import *

def main():
	x = int(input())
	b = 1
	while x > 0:
		y = log(x, 2)
		if y == int(y):
			break
		else:
			y = int(y)
			z = 2 ** y
			if z == x:
				break
			x = x - z
			b = b + 1
	print(b)
main()


bacteria = 0
poblacion = int(input())
while poblacion > 0:
	if poblacion % 2 != 0:
		poblacion -= 1
		bacteria += 1
	else:
		poblacion /= 2
print(bacteria)


x = int(input())
x2 = bin(x)
print(x2.count('1'))


s = list(map(int, bin(int(input()))[2:]))
counter = 0
for i in s:
	if i:
		counter += 1
print(counter)


n = int(input())
c = 0
for i in range(31):
	if n <= 1:
		c += n
		break
	else:
		for j in range(31):
			if 2 ** j > n:
				n = n - 2 ** (j - 1)
				c += 1
				break
print(c)


x = int(input())
y = bin(x)
a = y.count('1')
print(a)


def calc():
	n = int(input())
	cnt = 0
	while n > 0:
		if n & 1 != 0:
			cnt += 1
			n = n - 1
		n >>= 1
	return cnt
print(calc())


n = int(input())
col = 0
while n > 0:
	q = 0
	while 2 ** (q + 1) <= n:
		q += 1
	n -= 2 ** q
	col += 1
print(col)


n = int(input())
k = 1
while n != 1:
	if n % 2 != 0:
		k = k + 1
	n = n // 2
print(k)


x = int(input())
a = 2
k = 0
s = 0
while x != k:
	i = 0
	while a ** i <= x:
		k = a ** i
		i += 1
	s += 1
	if k < x:
		x = x - k
		k = 0
print(s)


x = int(input())
r = 0
while x > 3:
	y = x % 2
	x = x // 2
	r += y
if x == 3:
	print(2 + r)
else:
	print(r + 1)


from sys import stdin as si
from collections import Counter as c
from functools import reduce

class Solution:

	def bazinga(self, a):
		(c, tar) = (0, True)
		while a > 1:
			b = bin(a)[2:]
			l = len(b)
			m = 1 << l - 1
			a = a - m
			c += 1
		if a == 1:
			c += 1
		return c
n = int(si.readline().strip())
S = Solution()
print(S.bazinga(n))


import string, math
digs = string.digits + string.ascii_uppercase

def int2base(x, base):
	if x < 0:
		sign = -1
	elif x == 0:
		return digs[0]
	else:
		sign = 1
	x *= sign
	digits = []
	while x:
		digits.append(digs[x % base])
		x = math.floor(x / base)
	if sign < 0:
		digits.append('-')
	digits.reverse()
	return ''.join(digits)
c = 0
s = str(int2base(int(input()), 2))
for i in range(len(s)):
	if s[i] == '1':
		c += 1
print(c)


a = int(input())
b = bin(a)
print(b.count('1'))


n = int(input())
i = 0
j = 0
while n > 0:
	i += 1
	j += 1
	while 2 * i <= n:
		i *= 2
	n -= i
	i = 0
print(j)


n = int(input())
ans = 0
while 1:
	for i in range(30):
		if 2 ** i <= n < 2 ** (i + 1):
			ans += 1
			n -= 2 ** i
		if n == 0:
			print(ans)
			exit()


def main():
	n = int(input())
	x = 0
	while n != 0:
		if n & 1:
			x += 1
		n >>= 1
	print(x)
main()


x = int(input())
s = 0
for i in range(32):
	if x & 1 << i > 0:
		s += 1
print(s)


n = int(input())
s = bin(n).replace('0b', '')
c = 0
for i in range(len(s)):
	if s[i] == '1':
		c += 1
print(c)


x = int(input())
i = 1
a = [1]
while i <= x + 4:
	i = i * 2
	a.append(i)
p = x
t = 0
while p > 0:
	for each in a:
		if each <= p:
			c = each
	p = p - c
	t = t + 1
print(t)


def solve(x):
	s = 0
	while x > 0:
		s += x % 2
		x = x // 2
	return s

def main():
	x = int(input())
	print(solve(x))
main()


I = lambda : list(map(int, input().split()))
(n,) = I()
print(bin(n)[2:].count('1'))


a = int(input())
b = 0
x = 0
while a > 0:
	while 2 ** x <= a:
		x += 1
		if 2 ** x > a:
			a = a - 2 ** (x - 1)
			b += 1
			x = 0
print(b)


print(len([char for char in bin(int(input())) if char == '1']))


x = int(input())
powers = [1]
for i in range(0, 30):
	powers += [powers[-1] * 2]
counter = 0
if x in powers:
	counter = 1
	print(counter)
	quit()
else:
	while x > 0:
		for i in range(len(powers)):
			if x == powers[i]:
				x -= powers[i]
				counter += 1
				break
			elif x < powers[i]:
				x -= powers[i - 1]
				counter += 1
				break
print(counter)


import math
c = 0

def f(x):
	global c
	while x != 0:
		x = x - 2 ** int(math.log2(x))
		c = c + 1
	print(c)
	c = 0
x = int(input())
f(x)


a = int(input())
if a == 1:
	print(1)
else:
	ans = 1
	while a != 1:
		if a % 2:
			ans += 1
			a -= 1
		a /= 2
	print(ans)


x = int(input())
j = bin(x)
print(j.count('1'))


print(sum(map(int, list(bin(int(input()))[2:]))))


__author__ = 'artyom'

def main():
	return bin(read())[2:].count('1')

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
res = main()
write(res)


n = int(input())
n *= 2
cont = 0
while n:
	if n % 2:
		cont += 1
	n = n // 2
print(cont)


N = int(input())
Total = 0
NewNum = N
while True:
	NewNum = NewNum / 2
	if int(NewNum) != float(NewNum):
		Total += 1
		NewNum = int(NewNum)
	if NewNum < 1:
		break
print(Total)


n = int(input())
a = 0
while n != 0:
	a += n % 2
	n //= 2
print(a)


num = int(input())
cnt = 1
while num != 1:
	if num % 2 == 1:
		num -= 1
		cnt += 1
	num /= 2
print(cnt)


n = int(input())
cnt = 0
while n != 0:
	cnt += n & 1
	n = n >> 1
print(cnt)


def binary(n):
	while n > 0:
		yield (n % 2)
		n //= 2

def main():
	n = int(input())
	print(sum(binary(n)))
main()


from sys import stdin, exit
import math
x = int(stdin.readline().rstrip())
count = 0
while x > 0:
	count += x & 1
	x //= 2
print(count)


from sys import stdin, stdout
n = int(stdin.readline())
i = 0
while n > 1:
	if n % 2 == 0:
		n = n // 2
	else:
		n = (n - 1) // 2
		i += 1
print(i + 1)


n = int(input())
count = 0
while n != 0:
	i = 0
	while 2 ** i <= n:
		i += 1
	count += 1
	n -= 2 ** (i - 1)
print(count)


def decimalToBinary(n):
	return bin(n).replace('0b', '')
n = int(input())
k = decimalToBinary(n)
k = list(k)
print(k.count('1'))


a = int(input())
count = 0
while a != 0:
	if a % 2 != 0:
		count += 1
	a = a // 2
print(count)


x = int(input())
sum = 0
x1 = x
i = 0
count = 0
while sum != x:
	if 2 ** i <= x1:
		i = i + 1
	else:
		sum = sum + 2 ** (i - 1)
		x1 = x1 - 2 ** (i - 1)
		i = 0
		count = count + 1
print(count)


n = int(input())
c = 1
ctr = 0
while c <= n:
	if c & n:
		ctr += 1
	c *= 2
print(ctr)


X = int(input())
temp = 0
no = 1
while X > 0:
	if X & 1:
		temp += 1
	X = X >> 1
print(temp)


s = bin(int(input()))
s = list(map(int, str(s[2:])))
print(s.count(1))


from sys import *
a = int(input())
c = 0
while a != 0:
	if a % 2 == 1:
		c += 1
		a -= 1
	else:
		a = a // 2
print(c)


n = int(input())
m = bin(n)
print(list(m).count('1'))


n = eval(input())
e = 1
c = 1
while e != n:
	while e < n:
		e = e * 2
	if e == n:
		e = n
	elif e // 2 + 1 == n:
		c += 1
		e = n
	else:
		n = n - e // 2
		c += 1
		e = 1
print(c)


n = int(input())
least = 1
while n != 1:
	if n % 2 == 0:
		n = int(n / 2)
	else:
		least = least + 1
		n = int((n - 1) / 2)
print(least)


x = int(input())
f = 0
while x != 0:
	f += x % 2
	x //= 2
print(f)


number = int(input())
count = 0
for i in range(32, 0, -1):
	if number & 1 << i:
		count += 1
if number & 1 << 0:
	count += 1
print(count)


from sys import stdin, stdout

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()

def num(n):
	c = 0
	while n > 0:
		c += 1
		n = n & n - 1
	return c
n = ii()
print(num(n))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = int(data())
out(bin(n).count('1'))


n = int(input())
i = 1
c = 0
while i:
	if n % 2 == 0:
		n = n // 2
	else:
		n = n // 2
		c += 1
	if n == 0:
		break
print(c)


x = int(input())
convert = bin(x).replace('0b', '')
b = convert.count('1')
print(b)


from math import log2

def dosome(n):
	if n == 1:
		return 1
	y = int(log2(n))
	x = 2 ** y
	n -= x
	return dosome(n) + 1
n = int(input())
while n % 2 == 0:
	n //= 2
if n == 1:
	print(1)
else:
	print(dosome(n))


n = int(input())

def calc(n):
	c = 1
	for i in range(n):
		if c > n:
			res = c // 2
			break
		elif c == n:
			res = 1
			break
		c = c * 2
	return res
count = 0
for i in range(n):
	if calc(n) != 1:
		n = n - calc(n)
		count = count + 1
	else:
		print(count + 1)
		break


import itertools, functools, math

def solve():
	n = int(input())
	return bin(n).count('1')
print(solve())


x = int(input())
binary = bin(x)[2:]
cnt = 0
for c in binary:
	if c == '1':
		cnt += 1
print(cnt)


x = int(input())
x_bits = bin(x)
print(x_bits.count('1'))


n = int(input())
number = ''
while n > 0:
	x = str(n % 2)
	number = x + number
	n = n // 2
print(number.count('1'))


from math import log2, ceil
Input = lambda : map(int, input().split())
x = int(input())
yy = log2(x)
if yy == ceil(yy):
	print(1)
	exit()
ans = 1
while x != 1:
	ans += x % 2
	x //= 2
print(ans)


n = int(input())
ans = 1
while n != 1:
	if n % 2 == 1:
		ans += 1
		n -= 1
	else:
		n //= 2
print(ans)


def noOfSetBits(n):
	c = 0
	while n > 0:
		n = n & n - 1
		c += 1
	return c
n = int(input())
print(noOfSetBits(n))


def no_of_bacteria(n):
	count = 0
	rem = n
	while rem > 1:
		for i in range(rem + 1):
			if 2 ** i <= rem:
				continue
			else:
				break
		count = count + 1
		rem = rem - 2 ** (i - 1)
	if rem == 1:
		count = count + 1
	print(count)
n = input()
no_of_bacteria(int(n))


n = int(input())
b = bin(n)
b.replace('0b', '')
res = 0
for i in b:
	if i == '1':
		res += 1
print(res)


n = int(input())
bacteria = 0
while True:
	if n == 0:
		break
	if n % 2 != 0:
		bacteria += 1
	n = n // 2
print(bacteria)


import math
n = int(input())
a = 0
while n >= 1:
	n = n - 2 ** int(math.log2(n))
	a += 1
print(a)


num = int(input())
print(sum([int(x) for x in str(bin(num)[2:])]))


l = []
for i in range(0, 31):
	l.append(2 ** i)
l = l[::-1]
x = int(input())
b = 0
for i in range(31):
	if x - l[i] >= 0:
		x -= l[i]
		b += 1
print(b)


b = int(input())
b1 = b
l = []
l.append(b1)
while b1 != 1:
	if b1 % 2 == 0:
		l.append(b1 // 2)
		b1 = b1 // 2
	else:
		l.append(b1 // 2)
		b1 = b1 // 2
l.reverse()
bact = 1
count = 1
for i in range(0, len(l)):
	if bact != l[i]:
		bact += 1
		count += 1
	bact = bact * 2
print(count)


import math
bacteria = int(input())
count = 0
while bacteria > 0:
	day = int(math.log(bacteria, 2))
	bacteria = bacteria - math.pow(2, day)
	count = count + 1
print(count)


n = int(input())
m = 0
while n != 0:
	t = 0
	while 2 ** t <= n:
		t += 1
	n = n - 2 ** (t - 1)
	m += 1
print(m)


A = int(input())
summ = 0
while A > 0:
	if A % 2 == 1:
		summ += 1
	A //= 2
print(summ)


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
	stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

	def S():
		return stdin.readline().rstrip()

	def Sn():
		return stdin.readline().split(' ')

def Out(whatever):
	return stdout.write(whatever)
n = I()
print(bin(n).count('1'))


x = int(input())
count = 0
while x > 0:
	n = 1
	while x >= n:
		n = n * 2
	count += 1
	x = x - n // 2
print(count)


x = int(input())
bin_x = bin(x)
bin_one_sum = sum([int(val) for val in list(repr(bin_x)) if val in ['0', '1']])
print(bin_one_sum)


n = int(input())
total = 1
while n > 1:
	if n % 2:
		total = total + 1
	n = n // 2
print(total)


import sys
X = int(input())
b2 = '{0:b}'.format(X)
print(sum((1 for s in b2 if s == '1')))


n = int(input())

def fun(x):
	s = 1
	while x > 1:
		if x % 2 == 0:
			x = x // 2
		else:
			x = (x - 1) // 2
			s += 1
	return s
print(fun(n))


(x, v) = (int(input()), 0)
while x:
	(x, v) = (x & x - 1, v + 1)
print(v)


alenlist = []
result = 0
a = int(input())
for i in range(0, 30):
	alenlist.append(2 ** i)
for i in range(29, -1, -1):
	if a >= alenlist[i]:
		a -= alenlist[i]
		result += 1
	if a == 1:
		result += 1
		break
	if a == 0:
		break
print(result)


n = int(input())
ch = bin(n)
ch2 = ch[2:]
s = 0
for i in range(len(ch2)):
	if ch2[i] == '1':
		s += 1
print(s)


n = int(input())
d = str(bin(n))
print(d[2:].count('1'))


n = int(input())
bacteri = 0
while n > 1:
	bacteri += n % 2
	n = n // 2
print(bacteri + 1)


t = 1
for _ in range(t):
	s = int(input())
	ans = 0
	while s:
		ans += s % 2
		s //= 2
	print(ans)


x = int(input())
powe = 0
bact = 0
for i in range(10000):
	if 2 ** i > x:
		powe = i - 1
		break
for i in range(powe, -1, -1):
	if 2 ** i <= x:
		x -= 2 ** i
		bact += 1
	else:
		continue
print(bact)


n = int(input())
q = bin(n)
q = list(str(q))
print(q.count('1'))


x = int(input())
res = 0
while x > 0:
	if x % 2 == 0:
		x = x // 2
	else:
		x = x // 2
		res += 1
print(res)


n = int(input())
r = list(bin(n))
print(r.count('1'))


from math import log2, ceil, floor
n = int(input())
c = 1
while True:
	if floor(log2(n)) == ceil(log2(n)):
		print(c)
		break
	elif floor(log2(n - 1)) == ceil(log2(n - 1)):
		print(c + 1)
		break
	elif n % 2 == 0:
		n = n // 2
	else:
		n = n // 2
		c += 1


def bin(n):
	if n == 0:
		return [0]
	ls = []
	while n != 0:
		ls.append(n % 2)
		n = n // 2
	r = ls[::-1]
	return r
n = int(input())
l = bin(n)
c = 0
for i in l:
	if i == 1:
		c = c + 1
print(c)


def cal(n):
	res = 0
	while n:
		n &= n - 1
		res += 1
	return res
n = int(input())
print(cal(n))


n = int(input())

def func(n):
	if n == 1:
		return 1
	if n % 2 == 0:
		return func(n // 2)
	else:
		return 1 + func(n - 1)
print(func(n))


n = int(input())
ans = 0
while n > 0:
	cnt = 2
	for i in range(n):
		if cnt * 2 > n:
			break
		cnt = cnt * 2
	n = n - cnt
	ans += 1
print(ans)


n = int(input())
b = str(bin(n))
b = b[2:]
print(b.count('1'))


x = int(input())
l = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4]
cou = 0
while x:
	cou += l[x & 15]
	x = x >> 4
print(cou)


x = int(input())
cnt = 0
while x // 2 != 0:
	if x % 2 == 1:
		cnt += 1
	x = x // 2
print(cnt + 1)


def powerCalculator(num):
	base = 1
	power = 0
	while True:
		if num > base:
			base = base * 2
			power += 1
		elif num == base:
			return power
		else:
			return power - 1

def compute(left, count):
	power = powerCalculator(left)
	left -= 2 ** power
	if left == 1:
		print(count + 2)
		return
	if left == 0:
		print(count + 1)
		return
	count += 1
	return compute(left, count)
left = int(input())
count = 0
compute(left, count)


def maxPow(x):
	ans = 1
	for i in powers:
		if i <= x:
			ans = i
	return ans
x = int(input())
powers = [2 ** i for i in range(0, 31)]
ans = 0
while x != 0:
	x -= maxPow(x)
	ans += 1
print(ans)


import math

def main():
	n = int(input())
	rez = 0
	while n > 0:
		rez += n % 2
		n = n // 2
	print(rez)
main()


x = int(input())
s = []
for i in range(1, 30):
	s.append(2 ** i)
s.reverse()
n = 0
while x > 1:
	for i in s:
		if i <= x:
			x -= i
			n += 1
print(n + x)


x = int(input())
br = 0
for i in bin(x):
	if i == '1':
		br += 1
print(br)


a = int(input())
b = bin(a)
b = str(b)
cnt = b.count('1')
print(cnt)


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def can(m, s):
	if 0 <= s <= m * 9:
		return True
	return False

def main():
	n = int(input())
	while n % 2 == 0:
		n //= 2
	cnt = 0
	if n == 1:
		print(n)
	else:
		while n > 0:
			if n % 2 == 1:
				cnt += 1
			n //= 2
			if 2 ** int(math.log(n, 2)) == n:
				cnt += 1
				break
		print(cnt)
t = 1
for _ in range(t):
	main()


def parser():
	while 1:
		data = list(input().split(' '))
		for number in data:
			if len(number) > 0:
				yield number
input_parser = parser()

def get_word():
	global input_parser
	return next(input_parser)

def get_number():
	data = get_word()
	try:
		return int(data)
	except ValueError:
		return float(data)
x = get_number()
print(bin(x).count('1'))


s = 0
n = int(input())
i = 0
while i <= 32:
	if n >> i & 1:
		s = s + 1
	i = i + 1
print(s)


from math import log2
n = int(input())
bacteri = 0
while int(log2(n)) >= 1:
	bacteri += 1
	tmp = int(log2(n))
	n -= 2 ** tmp
	if n == 0:
		print(bacteri)
		exit()
print(bacteri + 1)


a = int(input())
s = bin(a)
k = 0
for i in range(len(s)):
	if s[i] == '1':
		k += 1
print(k)


def count_one(n):
	c = 0
	while n:
		n = n & n - 1
		c += 1
	return c
n = int(input())
print(count_one(n))


bacterias = int(input())

def count_ones(number):
	number = '{0:b}'.format(number)
	count = 0
	for digit in number:
		if digit == '1':
			count += 1
	return count
print(count_ones(bacterias))


n = int(input())
binary = bin(n)
print(sum(map(int, list(binary[2:]))))


f = lambda x: x % 2 + f(x // 2) if x else 0
print(f(int(input())))


bacteria = int(input())
amounts = []
split = 1
while split <= bacteria:
	amounts.append(split)
	split *= 2
days = 0
index = len(amounts) - 1
while bacteria > 0:
	if amounts[index] <= bacteria:
		bacteria -= amounts[index]
		days += 1
	else:
		index -= 1
print(days)


x = int(input())
b = str(bin(x))
c = b.count('1')
print(c)


n = int(input())
bn = bin(n)
su = 0
for i in str(bn):
	if i == '1':
		su += 1
print(su)


x = int(input())
ans = 0
for i in range(31):
	ans += x >> i & 1
print(ans)


a = int(input())
count = 1
while a > 1:
	if a % 2 == 0:
		a = a // 2
		continue
	else:
		a = a / 2
		a = int(a - 0.5)
		count += 1
print(count)


n = int(input())

def minimum_bacteria(n):
	a = n
	b = 0
	while a > 1:
		b += a % 2
		a = a // 2
	return b + 1
print(minimum_bacteria(n))


import math
n = int(input())
p = str(bin(n))
print(p.count('1'))


import sys
import math

def get_line():
	return list(map(int, sys.stdin.readline().strip().split()))

def in1():
	return int(input())
n = in1()
i = 0
t = 1
c = 0
while t < n:
	while t <= n:
		i += 1
		t = int(math.pow(2, i))
	n = n - int(math.pow(2, i - 1))
	t = 1
	c += 1
	i = 0
if n == 1:
	c += 1
print(c)


def tobinary(n):
	div = []
	while n != 0:
		div.insert(0, n % 2)
		n = n // 2
	return div
n = int(input())
print(tobinary(n).count(1))


n = int(input())
c = 0
for i in bin(n):
	if i == '1':
		c += 1
print(c)


num = int(input())
ans = 0
while num > 0:
	if num % 2 == 1:
		ans += 1
	num //= 2
print(ans)


from math import sqrt

def main():
	n = int(input())
	ans = bin(n).count('1')
	print(ans)
main()


x = int(input())
kol = 0
while x > 0:
	s = 0
	while 2 ** s <= x:
		s += 1
	s -= 1
	x -= 2 ** s
	kol += 1
print(kol)


n = int(input())
strr = '{0:b}'.format(n)
summ = 0
for i in strr:
	if i == '1':
		summ += 1
print(summ)


n = int(input())
kol = 0
while n != 0:
	a = 1
	while n >= a:
		a *= 2
	a /= 2
	kol += 1
	n -= a
print(kol)


n = int(input())
biary_sequence = bin(n)[2:][::-1]
print(sum([int(i) for i in biary_sequence if i == '1']))


x = int(input())
y = bin(x)[2:]
count = 0
for i in y:
	if i == '1':
		count += 1
print(count)


import math
n = int(input())
count = 0
while n > 0:
	k = int(math.log(n, 2))
	n = n - math.pow(2, k)
	count = count + 1
print(count)


from collections import defaultdict
import math
x = int(input())
binary = bin(x)
setBit = [ones for ones in binary[2:] if ones == '1']
print(len(setBit))


x = int(input())
sum = 0
while x > 0:
	last = x % 2
	sum += last
	x = x // 2
print(sum)


(A, c) = (int(input()), 0)
for i in range(100):
	c += 1 & A >> i
print(c)


x = int(input())
xlist = str(bin(x)[2:])
print(xlist.count('1'))


from sys import stdin
hat = stdin.readlines()
x = int(hat[0])
sol = 0
while x:
	if x & 1:
		sol += 1
	x //= 2
print(sol)


n = int(input())
a = str(bin(n).replace('0b', ''))
print(a.count('1'))


n = int(input())
x = bin(n)
c = 0
for i in range(len(x)):
	if x[i] == '1':
		c += 1
print(c)


n = int(input())
i = 0
a = 0
while 1:
	x = 2 ** i
	if x >= n:
		a += 1
		if x == n:
			break
		else:
			n = n - x / 2
		i = 0
		continue
	i += 1
print(a)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	X = Scanner.int()
	ans = 1
	while X > 1:
		if X % 2 == 1:
			ans += 1
			X -= 1
		X //= 2
	print(ans)
main()


(n, num) = (int(input()), 0)
while n != 0:
	num += n % 2
	n //= 2
print(num)


def maxpow(x):
	pow = 1
	while x > 1:
		x = x // 2
		pow = pow * 2
	return pow

def number(x):
	power = maxpow(x)
	number = 0
	while x > 0:
		multiple = x // power
		number = number + multiple
		x = x % power
		power = power // 2
	return number
x = int(input())
print(number(x))


def int_to_bin(i):
	if i == 0:
		return '0'
	s = ''
	while i:
		if i & 1 == 1:
			s = '1' + s
		else:
			s = '0' + s
		i //= 2
	return s
a = int(input())
print(int_to_bin(a).count('1'))


arr = []
while True:
	try:
		t = input()
	except EOFError:
		break
	arr.append(t)
for i in range(len(arr)):
	t = int(arr[i])
	cnt = 0
	while t:
		t = t & t - 1
		cnt += 1
	print(cnt)


import sys
import math
input = sys.stdin.readline

def int_array():
	return list(map(int, input().split()))
x = int(input())
print(bin(x).count('1'))


def decimalToBinary(n):
	return bin(n).replace('0b', '')
n = int(input())
d = decimalToBinary(n)
i = 0
z = 0
while i < len(d):
	if d[i] == '1':
		z = z + 1
	i = i + 1
print(z)


x = int(input())
m = bin(x)
print(m.count('1'))


n = int(input())
i = 1
x = 1
a = 1
while n > 0:
	if a < n:
		a = 2 ** i
		i += 1
	elif a == n:
		n = n - a
	else:
		n = int(n - a / 2)
		x = x + 1
		a = 1
		i = 1
print(x)


n = int(input())
s = str(bin(n))
print(s.count('1'))


n = int(input())
cnt = 0
while n:
	cnt += n % 2
	n //= 2
print(cnt)


x = int(input())
x = bin(x)[2:].replace('0', '')
print(len(x))


import math
x = int(input())
n = 1
while x > 1:
	n += x % 2
	x //= 2
print(n)


def solve():
	x = int(input())
	res = x
	count = 0
	while res > 0:
		if res % 2 != 0:
			res -= 1
			count += 1
		else:
			res = res // 2
	print(count)
solve()


import math
n = input()
n = int(n)
b = bin(n)
count = 0
for l in b:
	if l == '1':
		count += 1
print(count)


n = int(input())
answer = 0
for i in range(33):
	if n & 1 << i > 0:
		answer += 1
print(answer)


n = int(input())
b = bin(n)
l = list(b)
print(l.count('1'))


n = int(input())
counter = ans = 0
temp = 1
while counter != n:
	if temp * 2 > n - counter:
		counter += temp
		ans += 1
		temp = 1
	else:
		temp = temp * 2
print(ans)


x = int(input())
s = 0
while x > 0:
	i = 0
	while 2 ** i <= x:
		i += 1
	x -= 2 ** (i - 1)
	s += 1
print(s)


a = int(input())
b = list(format(a, 'b'))
print(b.count('1'))


n = int(input())
i = 0
while n > 0:
	i += n % 2
	n //= 2
print(i)


wb = int(input())
squareinc = 0
list_nums = []
num_bacteria = 0
for x in range(35):
	list_nums.append(2 ** squareinc)
	squareinc += 1
list_nums.insert(1, 1)
if wb in list_nums:
	print(1)
else:
	while wb != 0:
		inc = 0
		num_bacteria += 1
		for number in list_nums:
			if number < wb:
				inc = number
		wb -= inc
		if wb not in list_nums:
			continue
		else:
			num_bacteria += 1
			wb = 0
	print(num_bacteria)


def Main():
	n = int(input())
	ans = 0
	while n > 0:
		ans += 1 & n
		n = n >> 1
	print(ans)
Main()


x = int(input())
xBinary = str(bin(x))
total = 0
for x in xBinary:
	if x == '1':
		total += 1
print(total)


a = int(input())
total = 0
while a > 0:
	sub = 1
	while sub * 2 <= a:
		sub *= 2
	a -= sub
	total += 1
print(total)


pots_of_2 = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]

def find_minor(n):
	for (i, val) in enumerate(pots_of_2):
		if val > n:
			if i > 0:
				return pots_of_2[i - 1]
			else:
				return 1
n = int(input())
count = 0
while n > 0:
	n = n - find_minor(n)
	count += 1
print(count)


def bacteria(n):
	num = bin(n)[2:]
	count = 0
	for i in range(len(num)):
		if num[i] == '1':
			count += 1
	return count
n = int(input())
print(bacteria(n))


x = int(input())
binary = bin(x)[2:]
ans = 0
for i in binary:
	if i == '1':
		ans += 1
print(ans)


n = int(input())
m = bin(n)
l = list(m)
l = l[2:]
num = 0
for i in range(len(l)):
	if l[i] != '0':
		num += 1
print(num)


N = int(input())
count = 1
while N > 1:
	if N % 2 == 0:
		N = N // 2
	else:
		count += 1
		N -= 1
print(count)


from math import log2
n = int(input())
b = 1
while pow(2, int(log2(n))) != n:
	b += 1
	n -= pow(2, int(log2(n)))
print(b)


def g(x):
	if x == 0:
		return 0
	return g(x // 2) if x % 2 == 0 else g((x - 1) // 2) + 1
print(g(int(input())))


x = int(input())
bacteria_added = 0
bacteria_present = x
while bacteria_present > 1:
	if bacteria_present % 2 != 0:
		bacteria_added += 1
		bacteria_present -= 1
	else:
		bacteria_present /= 2
print(int(bacteria_added + 1))


x = int(input())

def check(i, x):
	while i <= x:
		i = i * 2
	return i / 2
ans = 0
while x >= 1:
	ans += 1
	x = x - check(1, x)
print(ans)


n = int(input())
temp = list(str(bin(n)))
temp.pop(0)
temp.pop(0)
print(temp.count('1'))


def findx(n, c):
	if n != 0:
		for i in range(0, n):
			if 2 ** i > n:
				i -= 1
				break
		findx(n % 2 ** i, c + 1)
	else:
		print(c)
n = int(input())
findx(n, 0)


t = int(input())
c = 0
while t != 0:
	if t % 2 == 1:
		c += 1
		t -= 1
	else:
		t = t // 2
print(c)


def bactery(number):
	days = 0
	while number > 0:
		if number % 2 == 1:
			days += 1
		number //= 2
	return days
print(bactery(int(input())))


n = int(input())
b = bin(n).replace('0b', '')
print(b.count('1'))


from sys import stdin, stdout
n = int(stdin.readline())
count = 0
while n > 0:
	count += int(n) % 2
	n /= 2
print(int(count))


def bacteria_count(num):
	count = 0
	while num > 0:
		num = num & num - 1
		count += 1
	return count
print(bacteria_count(int(input())))


n = int(input())
for i in range(n):
	if 2 ** i >= n:
		c = i - 1
		break
if c <= 0:
	print(1)
else:
	x = 0
	for j in range(c):
		r = n % 2 ** (c - j)
		if n != r:
			x += 1
			n = r
		if r == 1:
			print(x + 1)
			break
		elif r == 0:
			print(x)
			break


from math import floor
n = int(input())
ans = 0
while n != 1:
	ans += n % 2
	n = floor(n / 2)
print(ans + 1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	r = 0
	while n > 0:
		r += n % 2
		n //= 2
	return r
print(main())


n = int(input())
s = bin(n)
res = int(0)
for ch in s:
	if ch == '1':
		res += 1
print(res)


x = int(input())
count = 1
while x != 1:
	n = 1
	while n * 2 <= x:
		n = n * 2
	if n == x:
		break
	else:
		x = x - n
		count += 1
print(count)


import sys
n = int(input())
i = 1
cnt = 0
while i <= n:
	if i == n or i * 2 == n:
		cnt += 1
		break
	elif i * 2 < n:
		i = i * 2
	elif i * 2 > n:
		cnt += 1
		n -= i
		i = 1
print(cnt)


x = list(bin(int(input())))
x.remove('b')
a = [int(i) for i in x]
print(sum(a))


t = int(input())
count = 1
while t != 1:
	if t % 2 != 0:
		count += 1
	t = t // 2
print(count)


n = int(input())
x = 0
y = 1
while n > 0:
	while y * 2 <= n:
		y = y * 2
	x += 1
	n -= y
	y = 1
print(x)


def bacteria(n):
	if n != 0:
		if n % 2 == 0:
			return bacteria(n / 2)
		else:
			return 1 + bacteria(n // 2)
	else:
		return 0
print(bacteria(int(input())))


def sum_ones(n):
	count = 0
	while n != 0:
		n &= n - 1
		count += 1
	return count
print(sum_ones(int(input())))


import math

def main():
	n = int(input())
	count = 0
	while n > 1:
		days = math.floor(math.log2(n))
		n -= 2 ** days
		count += 1
	print(count + n)
main()


print(list(bin(int(input())).replace('0b', '')).count('1'))


x = int(input())
a = 0
while x > 0:
	last = x % 2
	a = a + last
	x = x // 2
print(a)


def bin(a):
	if a == 1 or a == 0:
		return a
	else:
		return a % 2 + 10 * bin(a // 2)
n = int(input())
n = bin(n)
a = str(n).count('1')
print(a)


x = int(input())
r = 0
for i in range(30, 0, -1):
	r += x // 2 ** i
	x %= 2 ** i
print(r + x)


import sys
lines = sys.stdin.read().split('\n')
n = int(lines[0])
print(sum(map(int, bin(n)[2:])))


def gp_2(x):
	lo = 0
	hi = 35
	while lo < hi:
		mid = (lo + hi) // 2
		if 2 ** mid < x and 2 ** (mid + 1) > x:
			break
		if 2 ** mid < x:
			lo = mid
		elif 2 ** mid > x:
			hi = mid
		else:
			break
	return mid

def solve(x):
	a = gp_2(x)
	b = x - 2 ** a
	if b == 0:
		return 1
	else:
		return 1 + solve(b)
print(solve(int(input())))


from functools import reduce
x = int(input())
k = reduce(lambda x, y: x + 1 if y == '1' else x, bin(x), 0)
print(k)


x = int(input())
cnt = 0
while x > 0:
	cnt += x % 2
	x //= 2
print(cnt)


a = int(input())
x = lambda v: v % 2 + x(v // 2) if v else 0
print(x(a))


(s, m) = (int(input()), 0)
for i in range(100):
	if s % 2 == 1:
		m += 1
	s = s // 2
	if m == 30:
		break
print(m)


x = int(input())
nr = 0
while x > 0:
	if x % 2 == 1:
		nr += 1
	x //= 2
print(nr)


__author__ = 'dwliv_000'
k = int(input())
z = 0
count = 0
while z <= k:
	q = 0
	while 2 ** q <= k - z:
		q = q + 1
	z = z + 2 ** (q - 1)
	count = count + 1
	q = 0
print(count - 1)


n = int(input())
s = bin(n)[2:]
out = 0
for i in s:
	if i == '1':
		out += 1
print(out)


x = int(input())
b = 1
while x > 1:
	if x % 2:
		x -= 1
		b += 1
	x //= 2
print(b)


(n, s) = (int(input()), 0)
while 0 < n:
	if 1 & n:
		s += 1
	n >>= 1
print(s)


import math
n = int(input())
count = 0
while n >= 2:
	x = math.floor(math.log(n, 2))
	n = n - pow(2, x)
	count += 1
print(count + n)


import sys
input = sys.stdin.readline
n = int(input())
print(bin(n).count('1'))


x = int(input())
abin = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
i = 0
count = 0
sum = 0
while count < 30:
	abin[i] = x % 2
	x = x // 2
	sum += abin[i]
	i += 1
	count += 1
print(sum)


x = int(input())
s = 0
while x > 0:
	if x & 1 == 1:
		s += 1
	x >>= 1
print(s)


n = int(input())
i = 29
ans = 0
while n != 0:
	if n >= 2 ** i:
		n = n - 2 ** i
		ans = ans + 1
	i = i - 1
print(ans)


from math import log2
num = int(input())

def left(n):
	return n - 2 ** int(log2(abs(n)))
bac = 0
retur = left(num)
while not num == 0:
	num = left(num)
	bac += 1
print(bac)


a = int(input())
cnt = 0
while a > 1:
	if a % 2 != 0:
		cnt += 1
	a //= 2
print(cnt + 1)


print(sum([int(x) for x in list(bin(int(input()))[2:])]))


__author__ = 'suvasish'
x = int(input())
bacteria = 1
val = t_val = 0
count = 1
_Break = False
while val <= x:
	i = 0
	while bacteria << i <= x:
		t_val = bacteria << i
		nv = val + t_val
		if nv == x:
			print(count)
			_Break = True
			break
		elif nv > x:
			t_val = (nv - val) / 2
			break
		i += 1
	val += t_val
	if _Break:
		break
	elif val == x:
		print(count)
		break
	count += 1


from math import log2
x = int(input())
output = 1
if int(log2(x)) == log2(x):
	print(output)
else:
	q = int(log2(x))
	bac = 2 ** q
	while bac != x:
		output += 1
		z = x - bac
		q = int(log2(z))
		bac += 2 ** q
	print(output)


n = int(input())
animals = 0
while n:
	if n % 2 == 0:
		n = n // 2
	else:
		n -= 1
		animals += 1
		n = n // 2
print(animals)


n = int(input())
o = 0
while n:
	o += n - n // 2 * 2
	n = n // 2
print(o)


def myfunc(x):
	if x == 1:
		return 1
	cnt = 0
	if x % 2 == 1:
		cnt = 1
		x -= 1
	cnt += myfunc(x // 2)
	return cnt
x = int(input())
cnt = myfunc(x)
print(cnt)


x = int(input())
y = 0
while x > 0:
	last = x % 2
	y = y + last
	x = x // 2
print(y)


n = int(input())
answer = 0
while n:
	if n & 1 == 1:
		answer += 1
	n = n >> 1
print(answer)


import math
(A, c) = (int(input()), 0)
for i in range(int(math.log2(A)) + 1):
	c += 1 & A >> i
print(c)


print(sum((c == '1' for c in '{:b}'.format(int(input())))))


x = int(input())
k = 0
while x > 0:
	last = x % 2
	if last == 1:
		k += 1
	x = x // 2
print(k)


x = int(input())
print(list('{0:b}'.format(x)).count('1'))


import math
x = int(input())
cnt = 1
while x > 0:
	ck = math.log2(x)
	if pow(2, int(ck)) == x:
		print(cnt)
		break
	else:
		x -= pow(2, int(ck))
		cnt += 1


def bacteria(n):
	if n == 0:
		return 0
	i = 1
	while i <= n:
		i *= 2
	i //= 2
	return 1 + bacteria(n - i)
n = int(input())
print(bacteria(n))


x = int(input())
a = 0
b = 0
while x / 2 >= 1:
	x_old = x
	if x % 2 != 0:
		a = 1
	else:
		a = 0
	x = int((x - a) / 2)
	b += a
b += x
b = int(b)
print(b)


def parse_input() -> int:
	return int(input())

def solve(n: int) -> int:
	return bin(n)[2:].count('1')
print(solve(parse_input()))


intro = input()
num = int(intro)
x = 0
while num >= 1:
	if num % 2 == 1:
		x += 1
		num -= 1
	else:
		num /= 2
print(x)


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	ans = 0
	while n:
		ans += n % 2
		n //= 2
	print(ans)
main()


x = int(input())
num_ones = 0
while x:
	(x, num_ones) = (x >> 1, num_ones + (x & 1))
print(num_ones)


from math import log
from math import floor
from math import ceil
bacteria = int(input())
n = floor(log(bacteria, 2))
a = [0] * (n + 1)
a[n] = bacteria
x = [0] * (n + 1)
while n >= 0:
	if a[n] % 2 == 0:
		x[n] = 0
	else:
		x[n] = a[n] % 2
	a[n - 1] = 1 / 2 * (a[n] - x[n])
	n -= 1
print(int(sum(x)))


x = int(input())
y = bin(x)
z = y.count('1')
print(z)


n = int(input())
sum = 0
while n > 0:
	sum = sum + n % 2
	n = n // 2
print(sum)


bacteria = int(input())
ans = 0
while bacteria > 0:
	ans += bacteria % 2
	bacteria //= 2
print(ans)


x = int(input())
binX = bin(x).replace('0b', '')
ans = binX.count('1')
print(ans)


a = int(input())
p = 0
while 1:
	q = a // 2
	m = a % 2
	p = m + p
	a = q
	if a < 1:
		break
print(p)


from math import log2
x = int(input())

def max_i(x):
	return int(log2(x))
i = 0
while x:
	x -= 2 ** max_i(x)
	i += 1
print(i)


i = int(input())
p = 1
while p <= i:
	p *= 2
p //= 2
wyn = 0
while i > 0:
	if i - p >= 0:
		i -= p
		wyn += 1
	p //= 2
print(wyn)


x = int(input())
sum = 0
while x > 0:
	a = x
	x >>= 1
	sum += a - (x << 1)
print(sum)


n = int(input())
ct = 0
for i in range(60):
	x = 1 << i
	if n & x == x:
		ct += 1
print(ct)


import math
n = int(input())
x = 0
while n > 0:
	y = int(math.log(n, 2))
	n = n - math.pow(2, y)
	x += 1
print(x)


k = int(input())
c = bin(k)
c = c[2:]
print(c.count('1'))


def growth(totalBact):
	if totalBact < 1:
		return 0
	if totalBact == 1:
		return 1
	growthBact = 2
	addBact = 1
	while growthBact <= totalBact:
		growthBact *= 2
	growthBact /= 2
	growthBact = int(growthBact)
	addBact += growth(totalBact - growthBact)
	return addBact

def main():
	totalBact = int(input())
	addBact = growth(totalBact)
	print(addBact)
	return ()
main()


x = int(input())
answer = 0
while x >= 1:
	if x % 2 == 1:
		answer += 1
		x -= 1
	else:
		x /= 2
print(answer)


x = int(input())
ricxvi = 1
cnt = 1
while ricxvi * 2 <= x:
	ricxvi = ricxvi * 2
	if ricxvi == x:
		print(cnt)
	if ricxvi * 2 > x:
		x = x - ricxvi
		ricxvi = 1
		cnt += 1
if x == 1:
	print(cnt)


from sys import stdin, stdout
stdout.write(str(bin(int(stdin.readline().rstrip()))[2:].count('1')))


def count_one(n):
	count = 0
	while n > 0:
		n = n & n - 1
		count += 1
	return count
n = int(input())
print(count_one(n))


n = int(input())
s = bin(n)[2:]
print(sum(list(map(int, s))))


from sys import stdin
print(bin(int(stdin.readline())).count('1'))


A = int(input())
k = 0
while A > 0:
	k += A % 2
	A = A // 2
print(k)


s = int(input())
x = bin(s)
answer = 0
for i in x:
	if i == '1':
		answer += 1
print(answer)


def main():
	b = int(input())
	i = 0
	while b > 0:
		c = 1
		while b >= c * 2:
			c *= 2
		b = b - c
		i += 1
	print(i)
main()


import os
import sys
import math
import collections

def get_int():
	return int(input())

def get_ints():
	return map(int, input().split())

def get_strs():
	return input().split()

def get_float():
	return float(input())

def get_floats():
	return map(float, input().split())

def list_strs():
	return list(input().split())

def list_ints():
	return list(map(int, input().split()))

def list_floats():
	return list(map(float, input.split()))

def post(x):
	print(x, end=' ')
a = get_int()
print(bin(a).count('1'))


x = int(input())
bact = 0
while x > 0:
	last = x % 2
	bact = bact + last
	x = x // 2
print(bact)


n = int(input())
b = bin(n)
ans = 0
for i in range(2, len(b)):
	if b[i] == '1':
		ans += 1
print(ans)


n = int(input())
a = 2 ** 40
ans = 0
while n > 0:
	if n >= a:
		n -= a
		ans += 1
	a //= 2
print(ans)


print(list(str(bin(int(input())))).count('1'))


x = int(input())
(count, i) = (0, 0)
while True:
	if 2 ** i == x:
		count += 1
		break
	elif 2 ** i > x:
		count += 1
		x -= 2 ** (i - 1)
		i = 0
	else:
		i += 1
print(count)


x = int(input())
cnt = 0
while x != 0:
	x = x & x - 1
	cnt += 1
print(cnt)


print(sum(map(lambda x: x is '1', bin(int(input())))))


n = int(input())
result = 1
while n != 1:
	result = result + n % 2
	n = n // 2
print(result)


b = int(input())
bin(b)
c = 0
while b:
	c = c + (b & 1)
	b >>= 1
print(c)


L = [2 ** i for i in range(50)][::-1]
N = int(input())
count = 0
while N > 0:
	ind = 0
	while L[ind] > N:
		ind += 1
	N -= L[ind]
	count += 1
print(count)


a = int(input())
i = 0
if a % 2 == 1:
	while a != 1:
		x = 1
		lx = 1
		while a > x:
			lx = x
			x *= 2
		a = a - lx
		i += 1
	print(i + a)
elif a % 2 == 0:
	while a != 0:
		x = 1
		lx = 1
		while a >= x:
			lx = x
			x *= 2
		a = a - lx
		i += 1
	print(i)


def max_power_of_two(x):
	p = 1
	while p <= x:
		p *= 2
	return p // 2

def count_bacteria(x):
	b = 0
	d = -1
	while d != 0 and d != 1:
		p = max_power_of_two(x)
		d = x - p
		x = d
		b += 1
	b += d
	return b
x = int(input())
print(count_bacteria(x))


x = int(input())
u = bin(x).replace('0b', '')
bacteria = 0
for i in u:
	if i == '1':
		bacteria = bacteria + 1
print(bacteria)


x0b = bin(int(input()))
print(len(''.join(str(x0b).split('0'))) - 1)


import sys
a = int(input())
ans = 0
while a != 1:
	if a % 2 == 0:
		a = a // 2
	else:
		ans += 1
		a = a - 1
print(ans + 1)


def bact(n):
	if n < 2:
		return n
	if n % 2 == 0:
		while n % 2 == 0:
			n = n // 2
		return bact(n)
	else:
		return bact(n - 1) + 1
n = int(input())
print(bact(n))


import math
x = int(input())
ans = 0
while x:
	ans += x & 1
	x >>= 1
print(ans)


import math
n = int(input())
L = [c for c in bin(n) if c == '1']
print(len(L))


x = int(input())
y = 1
z = 1
while x != 1:
	y = 1
	while y < x:
		y = y * 2
	if y == x:
		break
	y = y / 2
	x = x - y
	z += 1
print(z)


def decay(x):
	if x == 0:
		return 0
	else:
		cur = 1
		while cur <= x:
			cur *= 2
		cur //= 2
		return 1 + decay(x - cur)
print(decay(int(input())))


import math
x = int(input())
y = math.floor(math.log2(x))
i = 0
j = 0
while x > 0:
	if x - 2 ** (y - j) >= 0:
		x = x - 2 ** (y - j)
		i = i + 1
	j += 1
print(i)


from math import log
n = int(input())
counter = 0
while n >= 2:
	n -= 2 ** int(log(n, 2))
	counter += 1
if n == 1:
	counter += 1
print(counter)


N = int(input())

def poweroftwo(k):
	roster = []
	for i in range(0, 64):
		x = 1
		if k & x << i > 0:
			roster.append(i)
	return len(roster)
print(poweroftwo(N))


a = int(input())
division = 0
contador = 0
while a != 0:
	division = a // 2
	contador += a % 2
	a = division
print(contador)


from queue import Queue
read = lambda : list(map(int, input().split()))
n = int(input())
k = 0
while n:
	k += n & 1
	n >>= 1
print(k)


x = int(input())
print(bin(x).replace('0b', '').count('1'))


def small_power(n):
	t = 0
	while n >= 2 ** t:
		t = t + 1
	return t - 1
small_power(9)
n = int(input())
var = n
counter = 1
while var > 1:
	pow = small_power(var)
	var = var - 2 ** pow
	if var >= 1:
		counter = counter + 1
print(counter)


def minimas_bacterias(bacterias_en_caja):
	min_bacterias = 0
	while bacterias_en_caja != 1:
		min_bacterias += bacterias_en_caja % 2
		bacterias_en_caja = int(bacterias_en_caja / 2)
	return min_bacterias + 1
bacterias = int(input())
print(minimas_bacterias(bacterias))


import math
import sys
bacterias_how_much_we_need = int(sys.stdin.readline())

def isPowerOfTwo(n):
	if n % 2 != 0:
		return False
	while n > 0:
		if n == 2:
			return True
		elif n % 2 != 0:
			return False
		n = n / 2
	return False

def solution(bacterias_how_much_we_need):
	if bacterias_how_much_we_need == 1:
		return print(1)
	elif bacterias_how_much_we_need == 0:
		return print(0)
	a = True
	bacterias = 0
	while a:
		if isPowerOfTwo(bacterias_how_much_we_need):
			if bacterias == 0:
				return print(1)
			else:
				return print(bacterias + 1)
		elif bacterias_how_much_we_need % 2 == 0:
			bacterias_how_much_we_need = bacterias_how_much_we_need / 2
		else:
			bacterias_how_much_we_need = bacterias_how_much_we_need - 1
			bacterias += 1
solution(bacterias_how_much_we_need)


x = int(input())
s = bin(x)
s = s[2:]
bacteria = 0
for i in range(len(s)):
	bacteria += int(s[i])
print(bacteria)


x = int(input())
total = 0
while x >= 1:
	total += x % 2
	x //= 2
print(total)


no = int(input())

def fun(x):
	n = 1
	while n <= x:
		n = n * 2
	return int(n / 2)
sum = 0
c = 0
i = no
while sum != no:
	sum = sum + fun(i)
	i = no - sum
	c = c + 1
print(c)


N = int(input())
binary = list(bin(N))
print(binary.count('1'))


x = int(input())
t = 0
while x > 0:
	c = 0
	while 2 ** c <= x and c <= 30:
		c += 1
	x -= 2 ** (c - 1)
	t += 1
print(t)


x = int(input())
a = []
while x >= 1:
	a.append(x % 2)
	x = x // 2
print(a.count(1))


n = int(input())
a = 0
for i in range(2, len(bin(n))):
	if bin(n)[i] == '1':
		a += 1
print(a)


def check_log(num):
	i = 0
	while True:
		aux = 2 ** i
		if aux == num:
			return [True, 0]
		if aux > num:
			return [False, num - 2 ** (i - 1)]
		i += 1

def main():
	total = 0
	num = int(input())
	while True:
		total += 1
		aux = check_log(num)
		if aux[0]:
			break
		else:
			num = aux[1]
	print(str(total))
main()


def rb(n):
	if n == 1:
		return 1
	if n % 2 != 0:
		return 1 + rb(n // 2)
	return rb(n // 2)
print(rb(int(input())))


from sys import stdin, stdout

def solve(n):
	if n == 0:
		return 0
	if n & 1 ^ 1:
		return solve(n // 2)
	return 1 + solve(n // 2)
N = int(stdin.readline())
print(solve(N))


def main():
	n = int(input())
	x = str(bin(n)[2:]).count('1')
	print(x)
main()


from math import log2
x = int(input())
c = 0
while x != 0:
	x -= 2 ** int(log2(x))
	c += 1
print(c)


import sys
input_data = sys.stdin.readline().strip()
number = int(input_data)
print('{0:b}'.format(number).count('1'))


n = int(input())
s = 0
while n > 0:
	for i in range(30, -1, -1):
		if 2 ** i <= n:
			s += 1
			n -= 2 ** i
			break
print(s)


def solve(t):
	count = 0
	while t:
		count += t & 1
		t >>= 1
	return count
t = int(input())
ans = solve(t)
print(ans)


def main():
	total = int(input())
	count = 1
	while total > 1:
		if total % 2:
			count += 1
			total -= 1
		total /= 2
	print(count)
main()


n = int(input())
cnt = 0
b = list(bin(n))
for i in range(len(b)):
	if b[i] == '1':
		cnt += 1
print(cnt)


val = int(input())
count = 0
for i in range(32):
	count += 1 if val & 1 << i else 0
print(count)


import sys
from collections import defaultdict
from functools import lru_cache
from collections import Counter

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def main(x):
	if x == 0:
		return 0
	elif x % 2 == 0:
		return main(x / 2)
	else:
		return 1 + main((x - 1) / 2)
for (e, line) in enumerate(sys.stdin.readlines()):
	x = int(line.strip())
print(main(x))


def MinimoPasos(numero):
	contar = 0
	while numero > 0:
		if numero % 2 == 1:
			contar += 1
			numero -= 1
		else:
			numero = numero >> 1
	return contar
numero = int(input())
print(MinimoPasos(numero))


a = int(input())
b = 0
while a != 0:
	if a % 2 == 0:
		a /= 2
	else:
		b += 1
		a -= 1
print(b)


x = int(input())
diff = float('inf')
n = format(x, 'b')
print(n.count('1'))


x = int(input())
l = [2 ** i for i in range(31)]
bac = 0
rest = 0
j = 0
while True:
	while l[j] <= x:
		j += 1
	bac = bac + 1
	rest = x - l[j - 1]
	if rest == 0:
		break
	else:
		x = rest
		j = 0
print(bac)


n = int(input())
b = list(map(int, bin(n)[2:]))
print(sum(b))


def main():
	n = int(input())
	c = 0
	while n != 0:
		if n % 2 == 1:
			c += 1
		n = n // 2
	print(c)
main()


def dec_to_bin(a):
	cnt = 0
	while 2 ** cnt <= a:
		cnt += 1
	if cnt > 0:
		cnt -= 1
	var = a
	result = ''
	while cnt >= 0:
		if var >= 2 ** cnt:
			result += '1'
			var -= 2 ** cnt
		else:
			result += '0'
		cnt -= 1
	return result
a = int(input())
print(str(dec_to_bin(a)).count('1'))


def pops(k):
	ans = 0
	while k > 0:
		if k & 1:
			ans += 1
		k >>= 1
	return ans

def bits(k):
	ans = 0
	while k > 0:
		ans += 1
		k >>= 1
	return ans
print(pops(int(input())))


n = int(input())
s = 0
t = 0
while n:
	s = 0
	while 2 ** s <= n:
		s += 1
	t += 1
	n -= 2 ** (s - 1)
print(t)


n = int(input())
binary = bin(n)[2:]
print(binary.count('1'))


def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	if mode == 'file':
		n = int(f.readline())
	else:
		n = int(input())
	print(sum((n >> shift & 1 for shift in range(128))))
	if mode == 'file':
		f.close()
main()


from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
a = [1]
x = 1
while 1:
	x *= 2
	if x > 1000000000.0:
		break
	a.append(x)

def func(n, c, ans):
	if n == 0:
		ans = min(ans, c)
		return ans
	if n == 1:
		ans = min(ans, c)
		return ans
	for i in range(len(a)):
		if a[i] > n:
			break
	x = n - a[i - 1]
	ans = min(ans, c + x)
	ans1 = 10000000000
	ans2 = 10000000000
	if n & 1:
		ans1 = func(n // 2, c + 1, ans)
	else:
		ans2 = func(n // 2, c, ans)
	return min(ans1, min(ans2, ans))

def main():
	n = ii()
	ans = 10000000000
	print(func(n, 1, ans))
main()


x = int(input())
num = 0
while x > 0:
	num += x % 2
	x = x // 2
print(num)


from sys import stdin, stdout
import sys
INF = 100000000000.0
import bisect

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
from collections import defaultdict
import math
n = get_int()
ans = 0
while n:
	ans += n % 2
	n = n // 2
print(ans)


import math
n = int(input())
k = n
ans = 0
while k > 0:
	k -= 2 ** int(math.log(k, 2))
	ans += 1
print(ans)


x = int(input())
x = bin(x)
x = str(x)
a = 0
for i in x:
	if i == '1':
		a += 1
print(a)


n = int(input())
ncount = 1
while n != 1:
	if n % 2 == 0:
		n = int(n / 2)
	else:
		n -= 1
		ncount += 1
print(ncount)


n = int(input())
i = 0
while n > 0:
	if n % 2 != 0:
		i += 1
		n = n - 1
	else:
		n = n // 2
print(i)


def Bacteria(colony):
	a = 1
	while colony // a != (0 or 1):
		a = a * 2
	colony = colony - a
	bacteria = 1
	while colony != 0:
		a = a // 2
		if colony // a == (0 or 1):
			colony = colony - a
			bacteria = bacteria + 1
	return bacteria
n = int(input())
print(Bacteria(n))


x = bin(int(input()))[2:]
s = sum([int(i) for i in x])
print(s)


a = int(input())
c = 0
while a > 0:
	a -= a & (a ^ a - 1)
	c += 1
print(c)


import math
withFile = 0
if withFile == 1:
	fin = open('input.txt', 'r')
	fout = open('output.txt', 'w')

def getl():
	if withFile == 0:
		return input()
	else:
		return fin.readline()

def printl(s):
	if withFile == 0:
		print(s)
	else:
		fout.write(str(s))

def get_arr():
	x = getl().split(' ')
	if x[-1] == '':
		x = x[:-1]
	return list(map(int, x))

def f(x):
	if x == 0:
		return 0
	d = 1
	while d < x:
		d <<= 1
	if d != x:
		d >>= 1
	return 1 + f(x - d)
x = get_arr()[0]
print(f(x))
if withFile == 1:
	fin.close()
	fout.close()


print(bin(int(input())).lstrip('0b').count('1'))


a = int(input())
c = 0
b = 0
for i in range(0, 100):
	if 2 ** i > a:
		c += i ** 2
		break
for j in range(0, c):
	if a % 2 == 1:
		b += 1
	a = a // 2
print(b)


n = int(input())
check = 0
while n > 0:
	if n % 2 == 1:
		check += 1
	n = n // 2
print(check)


n = int(input())
an = 0
while n > 0:
	if n % 2 != 0:
		an += 1
		n -= 1
	n = n // 2
print(an)


def input_int():
	return int(input())

def input_str():
	return str(input())

def get_result(a):
	if a == 1:
		return a
	elif a == 0:
		return 0
	bin_a = bin(a)
	bin_a = bin_a[:2] + bin_a[3:]
	a = int(bin_a, 2)
	return get_result(a) + 1
a = input_int()
print(get_result(a))


import sys
X = int(sys.stdin.readline())
result = 0
while X > 0:
	result += X % 2
	X //= 2
print(result)


xStr = input()
x = int(xStr)
put = 0
while x > 0:
	if x % 2 == 0:
		x = x // 2
		continue
	else:
		put = put + 1
		x = x // 2
print(put)


n = int(input())
ans = 0

def func(n):
	i = 0
	while 2 ** i <= n:
		i += 1
	return i - 1
while n > 1:
	ans += 1
	n = n - 2 ** func(n)
if n == 1:
	print(ans + 1)
else:
	print(ans)


cnt = 0
for i in str(bin(int(input()))).lstrip('0b'):
	cnt += int(i)
print(cnt)


import sys, os.path
sys.setrecursionlimit(10 ** 5)

def mod():
	return 10 ** 9 + 7

def i():
	return sys.stdin.readline().strip()

def ii():
	return int(sys.stdin.readline())

def li():
	return list(sys.stdin.readline().strip())

def mii():
	return map(int, sys.stdin.readline().split())

def lii():
	return list(map(int, sys.stdin.readline().strip().split()))

def solve():
	a = ii()
	s = 1
	while a != 1:
		if a % 2 == 0:
			a //= 2
		elif a % 2 == 1:
			s += 1
			a -= 1
			a //= 2
	print(s)
for _ in range(1):
	solve()


import math
n = int(input())

def b(n):
	k = 0
	while 2 ** k <= n:
		if 2 ** k == n:
			return True
		else:
			k += 1
	return False

def f(n):
	if b(n) == True:
		return 1
	else:
		return 1 + f(n - 2 ** int(math.log(n, 2)))
print(f(n))


bacteria = int(input())
added = 0
while bacteria != 0:
	added += bacteria % 2
	bacteria = int(bacteria / 2)
print(added)


n = int(input())
res = 0
if n >= 1 or n <= 10 ^ 9:
	while n > 0:
		res = int(res + n % 2)
		n = n / 2
print(int(res))


from math import *
n = int(input())
ans = 0
while n > 1:
	ans += 1
	n = n - 2 ** int(log(n, 2))
if n == 1:
	print(ans + 1)
else:
	print(ans)


x = int(input())
n = 1
while x != 1:
	if x % 2 == 1:
		n = n + 1
	x = x // 2
print(n)


bacteria = bin(int(input()))
info = bacteria[2:]
total = 0
for i in info:
	if int(i) == 1:
		total += 1
print(total)


x = int(input())
cont = 1
bact = 1
while x >= 1:
	if int(x / 2) != x / 2:
		cont += 1
	x = int(x / 2)
cont += x - bact
print(cont)


def expo(mx):
	rem = 1
	while rem < mx:
		rem *= 2
		if rem > mx:
			rem /= 2
			break
	return rem
n = int(input())
res = 0
while n > 0:
	temp = expo(n)
	n -= temp
	res += 1
print(res)


n = int(input().strip())
k = 0
while n > 0:
	if n % 2 == 0:
		n = n // 2
	else:
		n = n - 1
		k += 1
print(k)


n = int(input())
x = bin(n)
y = x
print(x.count('1'))


n = int(input())
acum = 0
n = n * 2
n = n / 2
while 1 <= n:
	if int(n % 2) == 1:
		acum = acum + 1
	n = n / 2
print(acum)


def bacterias(bacteria, x=0):
	if bacteria != 0:
		if bacteria % 2 == 0:
			return bacterias(bacteria / 2, x)
		else:
			return bacterias(bacteria - 1, x + 1)
	else:
		return x
print(bacterias(int(input())))


import sys
n = int(input())
ans = 0
while n > 0:
	if n % 2 == 1:
		ans += 1
	n //= 2
print(ans)


x = int(input())
x2 = []
k = 1
while True:
	if 2 ** k <= x:
		x2.append(2 ** k)
		k += 1
	else:
		break
b = 0
for i in range(k - 1):
	if x >= x2[-1 - i]:
		x -= x2[-1 - i]
		b += 1
if x != 0:
	print(b + 1)
else:
	print(b)


a = int(input())
b = ''
while a != 1:
	b = b + str(a % 2)
	a = a // 2
b = b + '1'
c = ''
for i in range(len(b) - 1, -1, -1):
	c = c + b[i]
print(c.count('1'))


a = int(input())
bact = 0
if a == 1:
	print(a)
else:
	while True:
		if a % 2 == 1:
			bact += 1
		a = (a - a % 2) / 2
		if a == 1:
			bact += 1
			break
	print(bact)


x = int(input())
s = str(bin(x))[2:]
l = 0
for i in range(len(s)):
	if s[i] == '1':
		l += 1
print(l)


number = int(input())
transfer = bin(number).lstrip('0b')
result = ' '.join(transfer).split().count('1')
print(result)


def toStr(n, base):
	convertString = '0123456789ABCDEF'
	if n < base:
		return convertString[n]
	else:
		return toStr(n // base, base) + convertString[n % base]
x = int(input())
count = 0
a = toStr(x, 2)
for i in a:
	if i == '1':
		count += 1
print(count)


n = int(input())
k = 1
while n > 1:
	k += n % 2
	n = (n - n % 2) / 2
print(round(k))


a = input()
a = int(a)
summ = 0
while a > 0:
	l = a & 1
	summ = summ + l
	a = a >> 1
print(summ)


n = int(input())
b = bin(n)[2:]
b = b.replace('0', '')
print(len(b))


def raising_bacteria(b):
	return str(bin(b)).count('1')
x = int(input())
print(raising_bacteria(x))


import math
n = int(input())
if n == 1:
	print(1)
else:
	start = int(math.log2(n))
	solution = 0
	for i in range(start, -1, -1):
		bacteria = 2 ** i
		if n == 0:
			break
		elif bacteria <= n:
			n -= bacteria
			solution += 1
	print(solution)


import heapq as hp
import math

def primeSeive(n):
	l = [True] * (n + 1)
	l[0] = l[1] = False
	l[2] = l[3] = True
	for i in range(4, n + 1, 2):
		l[i] = False
	for i in range(9, n + 1, 3):
		l[i] = False
	for i in range(10, n + 1, 5):
		l[i] = False
	for i in range(7, int(math.sqrt(n)) + 1, 2):
		if l[i]:
			for j in range(i * i, n + 1, i):
				l[j] = False
	return [i for i in range(n + 1) if l[i]]

def unpack(func=int):
	return map(func, input().split())

def range_n():
	return range(int(input()))

def main():
	n = int(input())
	ans = 0
	while n > 1:
		k = n >> 1 << 1
		ans += n - k
		n = k >> 1
	ans += n
	print(ans)
main()


x = int(input().strip())
base = 1
count = 1
while base < x:
	base <<= 1
	if base > x:
		x -= base >> 1
		base = 1
		count += 1
print(count)


n = 0
n = int(input())
i = 0
count = 0
power = pow(2, i)
while n != 0:
	while power <= n:
		i = i + 1
		power = pow(2, i)
	n = n - pow(2, i - 1)
	i = 0
	power = pow(2, i)
	count = count + 1
print(count)


num = int(input())
binary = bin(num)
setBits = [ones for ones in binary[2:] if ones == '1']
print(len(setBits))


import math
Aantal = int(input())
machten2 = []
x = 2
i = 0
bacterie = 0
while x <= Aantal:
	machten2.append(x)
	x = 2 * x
	i = len(machten2)
while Aantal >= 2:
	while Aantal - machten2[i - 1] < 0:
		i = i - 1
	Aantal = Aantal - machten2[i - 1]
	bacterie += 1
if Aantal == 1:
	print(bacterie + 1)
else:
	print(bacterie)


yonax = bin(int(input()))
print(yonax.count('1'))


import sys
import math
x = int(input())
num = 1
ans = 0
ind = 0
while num <= x:
	if x & 1 << ind > 0:
		ans += 1
	num *= 2
	ind += 1
print(ans)


a = int(input())
sumlast = 0
while a > 0:
	last = a % 2
	sumlast = sumlast + last
	a //= 2
print(sumlast)


def base_2(a1):
	(j1, j2) = (0, 1)
	while j2 <= a1:
		j1 += 1
		j2 = 2 ** j1
	return 2 ** (j1 - 1)
n = int(input())
count = 0
while n >= 1:
	if n == 1:
		count = count + 1
		break
	else:
		k1 = base_2(n)
		n = n - k1
		count = count + 1
print(count)


import math
x = int(input())
minimo = 100000000000
total = 0
contador = 0
potencias = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824]
for i in range(len(potencias)):
	if potencias[i] > x:
		r = i - 1
		total += potencias[r]
		contador += 1
		while r >= 0:
			r = r - 1
			if total + potencias[r] <= x:
				total = total + potencias[r]
				contador += 1
			if total + potencias[r] <= x:
				break
		break
print(contador)


from functools import reduce
print(reduce(lambda x, y: int(x) + int(y), list(bin(int(input()))[2:])))


num = int(input())
check = 1
while num > 1:
	if num % 2 == 0:
		num = num / 2
	else:
		num = (num - 1) / 2
		check += 1
print(check)


import collections
from math import log2, log
import sys

def check(input):
	log2limit = log(input, 2)
	count = 1
	if log2limit.is_integer():
		minor = input - 2 ** log2limit
	else:
		minor = input - 2 ** int(log2limit) + count
	odds = range(3, 3 * 10, 2)
	for base in odds:
		count += base
		print(base)
		baseLog = log(input, base)
		if baseLog.is_integer():
			baseresult = input - base ** baseLog
		else:
			baseresult = input - base ** int(baseLog)
		baseresult = input - base ** baseLog
		if baseresult < minor:
			minor = baseresult

def divisor(input, count):
	if input == 1:
		return count
	if input % 2 == 0:
		return divisor(input / 2, count)
	return divisor(input // 2, count + 1)
print(divisor(int(sys.stdin.readline()), 1))


input_value = int(input())
real = 0
while input_value > 0:
	if input_value % 2 == 1:
		real += 1
	input_value //= 2
print(real)


x = int(input())
s = '{:b}'.format(x)
print(sum(map(int, s)))


a = int(input())
total = 0
while a > 0:
	total += a % 2
	a = a // 2
print(total)


import math
n = int(input())
m = 1
ans = 0
while n:
	ans += m & n
	n = n >> 1
print(ans)


bacteria = int(input())
count = 0
while bacteria > 0:
	last = bacteria % 2
	bacteria = bacteria // 2
	if last == 1:
		count += 1
print(count)


n = int(input())
binary = bin(n)
binary = binary[2:]
count = 0
for letter in binary:
	count += int(letter)
print(count)


def bacteria(a):
	if a == 1:
		return 1
	if a % 2 == 0:
		a = a // 2
		return bacteria(a)
	else:
		a = (a - 1) // 2
		return 1 + bacteria(a)
a = int(input())
print(bacteria(a))


def ab():
	a = int(input())
	b = 0
	while a != 0:
		if a % 2 == 0:
			a = a // 2
		else:
			a = a - 1
			b = b + 1
	print(b)
ab()


def bina(n):
	li = []
	while n > 0:
		li.append(n % 2)
		n = n // 2
	return sum(li)
print(bina(int(input())))


n = int(input())
s = bin(n)
ans = 0
n = len(s)
for i in range(n - 1, 1, -1):
	if s[i] == '1':
		ans += 1
print(ans)


import math as m

def count(x, ans):
	if m.log2(x) == m.floor(m.log2(x)):
		return ans
	else:
		temp = m.floor(m.log2(x))
		x = x - 2 ** temp
		ans += 1
		return count(x, ans)
x = int(input())
ans = count(x, 1)
print(ans)


a = int(input())
c = 0
while a > 0:
	if a % 2 == 1:
		c += 1
	a //= 2
print(c)


x = input()
x = int(x)
x = bin(x)
x = list(x)
del x[0]
del x[0]
digits = [int(k) for k in x]
print(sum(digits))


n = int(input())
bact = 1
while n > 1:
	bact += n % 2
	n //= 2
print(bact)


import math
n = int(input())
cnt = 0
while n:
	if n % 2 == 0:
		n = n // 2
	else:
		cnt += 1
		n = n // 2
print(cnt)


def func(x, minbac):
	if x != 1:
		if x % 2 == 0:
			x = x / 2
			func(x, minbac)
		else:
			minbac = minbac + 1
			x = (x - 1) / 2
			func(x, minbac)
	else:
		print(minbac)
x = int(input())
minbac = 1
func(x, minbac)


def Solve(n):
	ans = 0
	while n > 0:
		if n & 1:
			ans += 1
		n >>= 1
	print(ans)
Solve(int(input()))


def leastBacteria(x):
	if x == 1:
		return 1
	elif x % 2 == 0:
		return leastBacteria(x // 2)
	else:
		return 1 + leastBacteria((x - 1) // 2)
x = int(input())
print(leastBacteria(x))


x = int(input())
ans = bin(x).count('1')
print(ans)


from math import log
n = int(input())
ans = 0
while n >= 1:
	calc = int(log(n, 2))
	n = n - 2 ** calc
	ans += 1
print(ans)


n = int(input())
times = 0
while n > 0:
	if n % 2 == 0:
		n = n // 2
	else:
		times += 1
		n -= 1
print(times)


x = int(input())
from collections import Counter
print(Counter(bin(x))['1'])


line = str(bin(int(input())))
length = len(line)
value = 0
for i in range(length):
	if line[i] == '1':
		value += 1
print(value)


def reccurr(x):
	ans = 1
	for i in range(30):
		if x == 2 ** i:
			ans = 1
			return ans
		elif x > 2 ** i and x < 2 ** (i + 1):
			ans += reccurr(x % 2 ** i)
			return ans
x = int(input())
ans = reccurr(x)
print(ans)


n = eval(input())
ans = 0
while n:
	if n & 1:
		ans += 1
	n = n >> 1
print(ans)


bis = int(input())
ans = 0
while bis != 0:
	if bis & 1 != 0:
		ans += 1
	bis >>= 1
print(ans)


x = int(input())
print(sum([[0, 1][2 ** i & x > 0] for i in range(0, 31)]))


a = int(input())
bat = 0
while a != 0:
	bat += 1
	a = a & a - 1
print(bat)


from math import log2
x = int(input())
a = log2(x)
if a - int(a) == 0.0:
	print(1)
else:
	cou = 1
	b = 2 ** int(a)
	x = x - b
	a = log2(x)
	c = x - b
	if c != 0:
		while 1:
			cou += 1
			b = 2 ** int(a)
			c = x - b
			if c == 0:
				break
			x = c
			a = log2(x)
	print(cou)


import operator
import functools
bacterias = input()
nbac = functools.reduce(operator.add, map(int, bin(int(bacterias))[2:]))
print(nbac)


import math
a = int(input())
r = a
c = 0
while r != 0:
	l = int(math.log(r, 2))
	r -= 2 ** l
	c += 1
print(c)


import math
st = ''

def func(n):
	return bin(n).count('1')
for _ in range(1):
	n = int(input())
	st += str(func(n)) + '\n'
print(st)


x = int(input())
i = 0
while x > 0:
	last = x % 2
	if last == 1:
		i += 1
	x = x // 2
print(i)


n = int(input())
resp = 0
while n > 0:
	n &= n - 1
	resp += 1
print(resp)


def countset(n):
	count = 0
	while n:
		n = n & n - 1
		count += 1
	return count
n = int(input())
print(countset(n))


i = int(input())
answer = 0
while i != 0:
	if i % 2 == 1:
		answer = answer + 1
	i = i // 2
print(answer)


x = int(input())
result = 0
while x > 0:
	if x % 2 != 0:
		result += 1
	x = x // 2
print(result)


n = int(input())
b = bin(n)
c = b.count('1')
print(c)


from sys import stdin, stdout
n = int(stdin.readline().strip())
count = 0
while not n == 0:
	n = n & n - 1
	count = count + 1
stdout.write(str(count))


import math
n = int(input())
i = 0
while n != 0:
	tmp = math.floor(math.log(n, 2))
	n = n - 2 ** tmp
	i += 1
print(i)


import math
bacteria_needed = int(input())
print(bin(bacteria_needed).count('1'))


n = int(input())
c = 1
while n > 1:
	if n % 2 == 1:
		c = c + 1
	n = n // 2
print(c)


x = int(input())
y = 0
i = 1
while x > 0:
	last = x % 2
	y = y + last * i
	i *= 10
	x = x // 2
b = str(y)
b = b.count('1')
print(b)


a = 0
integeri = input('')
integer = int(integeri)
binaryy = bin(integer)
binaryi = str(binaryy)
binary = binaryi[2:]
for i in binary:
	if i == '1':
		a += 1
print(a)


def to_binstr(number):
	return bin(number)[2:].zfill(8)

def get_result():
	x = int(input())
	return to_binstr(x).count('1')
print(get_result())


a = int(input())
b = 0
while a > 0:
	a = a & a - 1
	b = b + 1
print(b)


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	x = I()
	c = bin(x)[2:].count('1')
	pf(str(c))
main()


n = int(input())
l = list(bin(n))
del l[:2]
print(l.count('1'))


def get_one_bits(n):
	if n == 0:
		return 0
	return n % 2 + get_one_bits(n // 2)
n = int(input())
print(get_one_bits(n))


x = int(input())
result = 0
while x != 0:
	result += x % 2
	x //= 2
print(result)


x = int(input())
res = '{0:b}'.format(x)
count = 0
for i in str(res):
	if i == '1':
		count = count + 1
print(count)


try:
	n = int(input())
	cnt = 1
	while n > 1:
		if n % 2 == 1:
			cnt += 1
			n -= 1
		n //= 2
	print(cnt)
except:
	pass


n = int(input())
tot = 0
while n > 0:
	tot += n & 1
	n >>= 1
print(tot)


k = int(input())
n = bin(k)
s = 0
for i in range(2, len(n)):
	s = s + int(n[i])
print(s)


def f(n):
	if n == 0:
		return 0
	if n % 2 == 1:
		return f(n // 2) + 1
	else:
		return f(n // 2)
n = int(input())
print(f(n))


n = int(input())
q = 29
w = 0
while n != 0:
	if n >= 2 ** q:
		n -= 2 ** q
		w += 1
	q -= 1
print(w)


n = int(input())
b = 1
while n > 1:
	if n % 2 == 0:
		n = n // 2
	else:
		n -= 1
		b += 1
print(b)


x = int(input())
bits = '{0:b}'.format(x)
days = sum((1 for b in bits if b == '1'))
print(days)


O = int(input())
print(bin(O).count('1'))


n = int(input())
nb2 = str(bin(n))
nb2 = nb2[2:]
total = sum([int(i) for i in nb2])
print(total)


p = []
k = 1
for i in range(32):
	p.append(k)
	k *= 2
n = int(input())
cnt = 0
for i in range(31, -1, -1):
	if n >= p[i]:
		cnt += 1
		n -= p[i]
print(cnt)


is_debug = False
x = int(input())
print(f"{bin(x).count('1')}")


a = int(input())
k = 0
while a > 0:
	if a % 2 == 0:
		a = a // 2
	else:
		a = a - 1
		k += 1
print(k)


from math import log2
s = 0
n = int(input())
while n != 0:
	s += 1
	n -= 2 ** int(log2(n))
print(s)


target = int(input())
n = 2
inside = 1
while n < target:
	n = n * 2
	if n * 2 == target:
		break
	if n * 2 > target:
		inside = inside + 1
		target = target - n
		n = 2
		if target == 0:
			inside = inside - 1
			break
print(inside)


n = int(input())
bacteria = 0
while n:
	bacteria += n % 2
	n /= 2
	n = int(n)
print(bacteria)


n = int(input())
s = 0

def f(x):
	t = 1
	while t <= x:
		t = t * 2
	return x - t / 2
while f(n) > 0:
	s = s + 1
	n = f(n)
print(s + 1)


n = int(input())
l = n.bit_length() - 1
a = pow(2, l)
x = 1
e = n - a
while e >= 1:
	l = e.bit_length() - 1
	a = pow(2, l)
	e = e - a
	x += 1
print(x)


import math
from sys import stdin, stdout
input = stdin.readline
x = int(input())
ans = 0
while x > 1:
	log = math.log(x, 2)
	n = int(log)
	ans += 1
	x -= 1 << n
ans += x
stdout.write(str(ans))


n = bin(int(input()))[2:]
k = 0
for i in n:
	if i == '1':
		k += 1
print(k)


import sys
import math
target = int(sys.stdin.read())
bacteria = 0
while True:
	max_value = 2 ** int(math.log(target, 2))
	if max_value == target or target == 1:
		bacteria += 1
		break
	else:
		bacteria += 1
		target = target - max_value
print(bacteria)


from math import log2
l = 2

def po(k):
	global l
	if l == 1:
		return 1
	if l == 0:
		return 0
	b = int(log2(k))
	l = k - pow(2, b)
	return 1 + po(l)
k = int(input())
num = po(k)
print(num)


count = int(input())
result = 0
for x in range(32):
	if count & 1 << x:
		result += 1
print(result)


k = int(input())
k = bin(k)
x = 0
for i in k:
	if i == '1':
		x += 1
print(x)


n = int(input())
import math
c = 0
while n > 0:
	c += 1
	n -= int(pow(2, int(math.log(n, 2))))
print(c)


def main():
	n = int(input())
	count = 0
	while n:
		count += n & 1
		n = n >> 1
	print(count)
main()


n = int(input())
m = list(bin(n))
s = 0
for x in m:
	if x == '1':
		s += 1
print(s)


x = int(input())
n = ''
a = int(0)
while x > 0:
	y = str(x % 2)
	n = y + n
	x = int(x / 2)
for i in n:
	if i == '1':
		a = a + 1
print(a)


import math

def main():
	x = int(input())
	s = 1
	while x % 2 ** math.floor(math.log2(x)) != 0:
		x -= 2 ** math.floor(math.log2(x))
		s += 1
	print(s)
main()


x = int(input())
y = list(map(int, format(x, 'b')))
print(sum(y))


import math
n = int(input())
p = 0
while n > 0:
	t = int(math.log2(n))
	n = n - math.pow(2, t)
	p = p + 1
print(p)


def fun(a, count):
	if a != 1:
		if a % 2 == 0:
			a = a / 2
			fun(a, count)
		else:
			count = count + 1
			a = (a - 1) / 2
			fun(a, count)
	elif a == 1:
		print(count)
a = int(input())
count = 1
fun(a, count)


n = int(input())
er = []
while n >= 1:
	mod = n % 2
	er.append(mod)
	n = n // 2
w = sum(er)
print(w)


import math
n = int(input())
c = 0
while n > 1:
	x = int(math.log(n, 2))
	c += 1
	n -= 2 ** x
c += 1
if n == 0:
	c -= 1
print(c)


n = int(input())
res = 1
while True:
	if n == 1:
		break
	temp = n % 2
	n //= 2
	if temp == 1:
		res += 1
print(res)


def rb(n):
	count = 0
	while n // 2 != 0:
		if n % 2 != 0:
			count += 1
		n = n // 2
	return count + 1
a = int(input())
print(rb(a))


import math
n = int(input())
if n is 1:
	print(1)
else:
	count = 0
	while n > 0:
		p = int(math.log2(n))
		n = n - 2 ** p
		count += 1
	print(count)


def count_bits_set(n):
	count = 0
	while n:
		n = n & n - 1
		count += 1
	return count
n = int(input())
print(count_bits_set(n))


a = int(input())
i = 0
k = 1
while a != 0:
	k = 1
	while k * 2 <= a:
		k *= 2
	a = a - k
	i += 1
print(i)


b = str(bin(int(input())))[2:]
t = 0
for i in b:
	if i == '1':
		t += 1
print(t)


from math import log2

def recursive_function(minimum_amt, expected_bacteria_amt):
	remainder = expected_bacteria_amt % 2 ** int(log2(expected_bacteria_amt))
	if remainder == 0:
		return minimum_amt
	elif remainder == 1:
		return minimum_amt + 1
	else:
		return recursive_function(minimum_amt + 1, remainder)
expected_bacteria_amt = int(input())
if log2(expected_bacteria_amt) == int(log2(expected_bacteria_amt)):
	minimum_amt = 1
else:
	minimum_amt = recursive_function(1, expected_bacteria_amt)
print(minimum_amt)


def closest(xx):
	a = 1
	while 2 * a <= xx:
		a = 2 * a
	return a
x = int(input())
ans = 0
while x > 0:
	a = closest(x)
	ans += 1
	x -= a
print(ans)


x = int(input())
x = '{0:08b}'.format(x)
print(x.count('1'))


x = int(input())
flag = 1
while x != 1:
	if x % 2 != 0:
		flag += 1
	x = x // 2
print(flag)


from math import *
n = int(input())
cnt = 0
while n > 0:
	n = n & n - 1
	cnt += 1
print(cnt)


n = int(input())
print(sum([1 for i in bin(n) if i == '1']))


n = int(input())
s = ''
s = bin(n)
s = s[2:]
s = s.replace('0', '')
print(len(s))


def sol(n):
	if n == 1:
		return 1
	res = 2
	while res <= n:
		res *= 2
	res //= 2
	if res == n:
		return 1
	else:
		return 1 + sol(n - res)
print(sol(int(input())))


import math
n = int(input())

def f(n):
	if n == 1:
		return 1
	if n % 2 != 0:
		return 1 + f(n // 2)
	return f(n // 2)
print(f(n))


import sys

def solution():
	num = int(sys.stdin.readline())
	count = 1
	if num == 1:
		print(count)
	while num > 0:
		if num % 2 != 0:
			num = num - 1
			count += 1
		else:
			while num % 2 == 0:
				num = num // 2
				if num == 1:
					return print(count)
solution()


x = int(input())
bx = '{0:b}'.format(x)
c = 0
for i in bx:
	if i == '1':
		c += 1
print(c)


n = int(input())
an = 0
x = bin(n)[2:]
print(x.count('1'))


import math
n = int(input())
c = 0
while n >= 1:
	n -= 2 ** int(math.log2(n))
	c += 1
print(c)


x = int(input())
b = list(bin(x)[2:])
print(b.count('1'))


from itertools import product
from math import ceil, gcd, sqrt
import string
from decimal import Decimal

def binary_table(string_with_all_characters, length_to_make):
	return [''.join(x) for x in product(string_with_all_characters, repeat=length_to_make)]

def all_possible_substrings(string):
	return [int(string[i:j]) for i in range(len(string)) for j in range(i + 1, len(string) + 1)]

def number_of_substrings(length):
	return int(length * (length + 1) / 2)

def is_prime(num):
	for i in range(2, num):
		if num / i == int(num / i) and num != i:
			return False
	return True
num = int(input())
last = 0
current = 2
put = 0
if num == 1:
	print(1)
else:
	while True:
		put += 1
		while current < num:
			last = current
			current *= 2
		if current == num:
			break
		while num - last < 0:
			last /= 2
		num -= last
		if num == 0:
			break
	print(put)


t = int(input())
c = 0
while t:
	if t & 1:
		c = c + 1
	t >>= 1
print(c)


x = int(input())
ans = 0
while x > 1:
	temp = x % 2
	x = x // 2
	ans += temp
print(ans + 1)


def GETBIT(x, bit):
	return x >> bit & 1
n = int(input())
rs = 0
for i in range(30):
	rs += GETBIT(n, i)
print(rs)


import math
N = int(input())
ans = 0
while N > 0:
	ans += N % 2
	N = int(N / 2)
print(ans)


n = int(input())
s = 1
while s < n:
	s *= 2
ans = 0
while True:
	if n == s:
		ans += 1
		break
	else:
		n -= s // 2
		ans += 1
		s = 1
		while s < n:
			s *= 2
print(ans)


x = input()
c = bin(int(x))
print(c.count('1'))


def R():
	return map(int, input().split())
a = list(R())[0]
ans = 0
while a > 0:
	b = a >> 1
	if b << 1 != a:
		ans += 1
	a = b
print(ans)


import math
n = int(input())
print(bin(n)[2:].count('1'))


n = int(input())
a = []
l = 0
for i in range(0, 45):
	a.append(pow(2, i))
a.reverse()
if n in a:
	print(1)
else:
	for i in range(len(a)):
		if n - a[i] >= 0:
			n = n - a[i]
			l += 1
	print(l)


import math
x = int(input())
a = 0
while x > 0:
	a = a + 1
	n = int(math.log(x, 2))
	x1 = 2 ** n
	x = x - x1
print(a)


amount = int(input())
counter = 0
while amount > 0:
	if amount % 2 == 1:
		counter += 1
		amount -= 1
	else:
		amount = int(amount / 2)
print(counter)


x = int(input())
temp = 1
time = 0
while temp < x:
	temp *= 2
	time += 1
res = 0
while x > 0:
	temp = 1
	while temp <= x:
		temp *= 2
	x -= temp / 2
	res += 1
print(res)


def CF579A():
	return str(bin(int(input()))).count('1')
print(CF579A())


print(bin(int(input().strip()))[2:].count('1'))


n = int(input())
a = n // 2
b = n % 2
x = b
while a > 1:
	n = a
	a = n // 2
	b = n % 2
	x += b
print(x + a)


num1 = int(input())
c = 0
while int(num1 / 2) != 0:
	if num1 % 2 == 1:
		c += 1
	num1 = int(num1 / 2)
print(c + 1)


x = int(input())

def ones(x):
	ans = 0
	while x:
		x &= x - 1
		ans += 1
	return ans
print(ones(x))


total_bacteria = int(input(''))

def bitLenCount(int_type):
	length = 0
	count = 0
	while int_type:
		count += int_type & 1
		length += 1
		int_type >>= 1
	return (length, count)
(length, count) = bitLenCount(total_bacteria)
print(count)


x = int(input())

def f(x):
	if x == 0:
		return 0
	elif x == 1:
		return 1
	else:
		i = 1
		while pow(2, i) <= x:
			i += 1
		a = x - pow(2, i - 1)
		return 1 + f(a)
print(f(x))


number = bin(int(input())).replace('0b', '')
print(number.count('1'))


i = int(input())
print(bin(i).count('1'))


n = int(input())
b = str(bin(n))
b = b[2:]
ct = 0
for i in b:
	if i == '1':
		ct += 1
print(ct)


n = int(input())
n = bin(n)[2:]
bac = 0
for d in n:
	if d == '1':
		bac += 1
print(bac)


x = int(input())
num = 0
while x > 0:
	t = x % 2
	x = x // 2
	if t == 1:
		num += 1
print(num)


y = int(input())
z = 0
while y:
	z += y % 2
	y //= 2
print(z)


print(sum((i == '1' for i in bin(int(input()))[2:])))


x = int(input())
out = 1
while x > 1:
	if x % 2 == 1:
		out += 1
	x //= 2
print(out)


import math
n = int(input())

def bact(n):
	y = n
	x = 0
	count = 0
	while y > 0:
		x = int(math.log(n, 2))
		y = n - 2 ** x
		count = count + 1
		n = y
	return count
print(bact(n))


import math
input_s = int(input())
result = 0
while input_s > 0:
	i = 0
	m = math.pow(2, i)
	while input_s >= m:
		i += 1
		m = math.pow(2, i)
	input_s -= math.pow(2, i - 1)
	result += 1
print(result)


x = int(input())
k = 0
while x != 0:
	k += 1
	m = 0
	while 2 ** m <= x:
		m += 1
	x -= 2 ** (m - 1)
print(k)


a = int(input())
ans = 0
while a != 0:
	j = 0
	while a % 2 == 0:
		j = 1
		a //= 2
	if j == 0:
		ans += 1
		a -= 1
print(ans)


x = int(input())
sum = 0
while x > 0:
	if x % 2 != 0:
		sum = sum + 1
		x = x // 2
	else:
		x = x // 2
print(sum)


a = int(input())
t = 0
d = 0
for _ in range(30):
	if a % 2 != 0 and a > 0:
		d += 1
	a = a // 2
print(d)


n = int(input())

def A(n):
	i = 1
	while n > 0:
		if n % 2 == 0:
			n = n // 2
		else:
			i = i + 1
			n = n - 1
	return i - 1
print(A(n))


value = int(input())
print(bin(value).count('1'))


try:
	n = int(input())
	c = 0
	while n // 2 != 0:
		if n % 2 == 1:
			c += 1
		n = n // 2
	c = c + 1
	print(c)
except:
	pass


import math
t = int(input())
if math.log2(t) % 1 == 0:
	print('1')
else:
	print(bin(t).count('1'))


def myFunction(x):
	n = 0
	for i in range(31):
		if 2 ** i > x:
			n += 1
			x -= 2 ** (i - 1)
			if x > 1:
				n += myFunction(x)
			elif x == 1:
				n += 1
			break
	return n
x = int(input())
n = myFunction(x)
print(n)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
x = int(input())
ans = 0
while x > 0:
	if x % 2 == 1:
		ans += 1
	x //= 2
print(ans)


x = int(input())
res = 0
while x > 0:
	(d, r) = divmod(x, 2)
	res += r
	x = d
print(res)


n = int(input())

def f(n):
	i = 0
	c = 0
	while True:
		if c > n:
			break
		else:
			a = c
			c = 2 ** i
			i += 1
	return a
count = 0
if n == f(n):
	print('1')
else:
	while n > 1:
		count += 1
		n = n - f(n)
	print(n + count)


x = int(input())
if x & x - 1 == 0:
	print(1)
else:
	val = bin(x)[2:]
	print(val.count('1'))


import math
a = int(input())

def power(n):
	x = 0
	p = math.pow(2, x)
	while p < a:
		x += 1
		p = math.pow(2, x)
	return x - 1
if a % math.pow(2, power(a)) == 0:
	print('1')
else:
	c = 1
	while True:
		r = a % math.pow(2, power(a))
		if r != 0:
			c += 1
			a = r
		else:
			break
	print(c)


a = int(input())

def rev(x):
	x = list(str(x))
	x.reverse()
	x = ''.join(x)
	x = int(x)
	return x
last = 0
c = 0
while a > 0:
	b = a % 2
	last = str(last) + str(b)
	a = a // 2
last = rev(last)
while last > 0:
	t = last % 10
	c += t
	last = last // 10
print(c)


from math import log2, floor
(n, c) = (int(input()), 0)
while n != 0:
	n = n - pow(2, floor(log2(n)))
	c += 1
print(c)


res = int(input())
print(bin(res).count('1'))


def recurse(remainder):
	retval = 0
	if remainder == 0:
		return 0
	else:
		power = 0
		inLoop = True
		while inLoop:
			if int(remainder // 2 ** power) == 1:
				inLoop = False
				return 1 + recurse(remainder % int(2 ** power))
			else:
				power = power + 1
inputVal = int(input())
print(recurse(inputVal))


import math
from collections import Counter

def get(f):
	return map(f, input().split())

def divides(a, b):
	return a % b == 0

def main():
	x = int(input())
	ans = 0
	while x > 0:
		x -= 2 ** math.floor(math.log2(x))
		ans += 1
	print(ans)
main()


x = int(input())
x = bin(x)
c = 0
for i in x:
	if i == '1':
		c += 1
print(c)


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
x = int(input())
t = 0
if x == 1:
	print(1)
	exit()
while True:
	if x % 2 == 0:
		x //= 2
	else:
		x -= 1
		t += 1
		x //= 2
	if x == 1:
		break
print(t + 1)