Programmers' kids solve this riddle in 5-10 minutes. How fast can you do it?


-----Input-----

The input contains a single integer n (0 ≤ n ≤ 2000000000).


-----Output-----

Output a single integer.


-----Examples-----
Input
11

Output
2

Input
14

Output
0

Input
61441

Output
2

Input
571576

Output
10

Input
2128506

Output
3

Difficulty: introductory

Starter code:

Solutions:
TASK = "stars"
# FIN = open(TASK + ".in")
# FOUT = open(TASK + ".out", "w")

a = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 1, 0, 0]
ans = 0
n = int(input())
if n == 0:
    print(1)
    return
while (n > 0):
    tmp = n % 16
    ans += a[tmp]
    n //= 16

print(ans)

# FIN.close()
# FOUT.close()


import sys

a = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 1, 0, 0]

n = int(input())
if n == 0:
    print(1)
    return
s = 0
while n:
    s += a[n % 16]
    n //= 16
print(s)



zc = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 1, 0, 0]

n = int(input())

if (n == 0):
    print(1)
else:
    sum = 0
    while (n):
        sum += zc[n % 16]
        n //= 16
    print(sum)

n = int(input())

hexa = hex(n)


x = {
    '0': 1,
    '1': 0,
    '2': 0,
    '3': 0,
    '4': 1,
    '5': 0,
    '6': 1,
    '7': 0,
    '8': 2,
    '9': 1,
    'a': 1,
    'b': 2,
    'c': 0,
    'd': 1,
    'e': 0,
    'f': 0
}

def toInt(c):
    return x[c]


print(sum(map(toInt, hexa[2:])))


f = {'0' : 1, '1' : 0, '2' : 0, '3' : 0, '4' : 1, '5' : 0, '6' : 1, '7' : 0, '8' : 2, '9' : 1, 'A' : 1, 'B' : 2, 'C' : 0, 'D' : 1, 'E' : 0, 'F' : 0}
n = '%X' % int(input())
s = 0
for i in n: s += f[i]
print(s)


d = {
  '0': 1,
  '1': 0,
  '2': 0,
  '3': 0,
  '4': 1,
  '5': 0,
  '6': 1,
  '7': 0,
  '8': 2,
  '9': 1,
  'a': 1,
  'b': 2,
  'c': 0,
  'd': 1,
  'e': 0,
  'f': 0,
}

print(sum([d[c] for c in hex(int(input()))[2:]]))

n = int(input())

a = []
if n == 0:
    a.append(0)
while n > 0:
    a.append(n % 16)
    n //= 16

b = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 1, 0, 0]

ans = 0
for x in a:
    ans += b[x]
print(ans)


d = {
    '0': 1,
    '1': 0,
    '2': 0,
    '3': 0,
    '4': 1,
    '5': 0,
    '6': 1,
    '7': 0,
    '8': 2,
    '9': 1,
    'a': 1,
    'b': 2,
    'c': 0,
    'd': 1,
    'e': 0,
    'f': 0,
}
print(sum(d[c] for c in hex(int(input()))[2:]))


"""
Codeforces April Fools Contest 2017 Problem B

Author  : chaotic_iak
Language: Python 3.5.2
"""

################################################### SOLUTION

def main():
    n, = read()
    n = hex(n).upper()[2:]
    dc = [1,0,0,0,1,0,1,0,2,1,1,2,0,1,0,0]
    sm = 0
    for c in n:
        if ord(c) < 58:
            sm += dc[ord(c)-48]
        else:
            sm += dc[ord(c)-65+10]
    print(sm)

#################################################### HELPERS

def read(callback=int):
    return list(map(callback, input().strip().split()))

def write(value, end="\n"):
    if value is None: return
    try:
        if not isinstance(value, str):
            value = " ".join(map(str, value))
    except:
        pass
    print(value, end=end)

write(main())


x = int(input())
s=hex(x).split('x')[-1]
ans=0
for c in s:
    if c in '0469ad':
        ans+=1
    elif c in '8b':
        ans+=2
print(ans)


s = hex(int(input()))[2:].upper()
x = 0
x += s.count('0')
x += s.count('4')
x += s.count('6')
x += s.count('8') << 1
x += s.count('9')
x += s.count('A')
x += s.count('B') << 1
x += s.count('D')
print(x)


x = int(input())
t = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 1, 0, 0]
if x == 0:
    print('1')
    return
y = 0
while x > 0:
    y += t[x % 16]
    x //= 16
print(y)


p = int(input())
s = hex(p).upper()[2:]
# print(s)
ans = 0
# 0123456789abcdf
for x in s:
    if x == '0':
        ans += 1
    if x == '8':
        ans += 2
    if x == 'A':
        ans += 1
    if x == 'B':
        ans += 2
    if x == '9':
        ans += 1
    if x == 'D':
        ans += 1
    if x == '4':
        ans += 1
    if x == '6':
        ans += 1
print(ans)

# -*- coding: utf-8 -*-

import sys

mp = {
    '0': 1,
    '1': 0,
    '2': 0,
    '3': 0,
    '4': 1,
    '5': 0,
    '6': 1,
    '7': 0,
    '8': 2,
    '9': 1,
    'A': 1,
    'B': 2,
    'C': 0,
    'D': 1,
    'E': 0,
    'F': 0
}

for line in sys.stdin:
    N = hex(int(line)).upper()
    ans = 0
    for c in N[2:]:
        ans += mp[c]
    print(ans)


val = {'0':1, '1':0, '2':0, '3':0, '4':1, '5':0, '6':1, '7':0, '8':2, '9':1, 'a':1, 'b':2, 'c':0, 'd':1, 'e':0, 'f':0}
ans = 0
for c in hex(int(input()))[2:]:
    ans += val[c]
print(ans)

def main():
    n = int(input())
    n = hex(n)[2:]
    ans = 0
    for c in n:
        if c == '0' or c == '6' or c == '9' or c == 'a' or c == 'd' or c == '4':
            ans += 1
        if c == '8' or c == 'b':
            ans += 2
    print(ans)

def __starting_point():
    main()

__starting_point()

# 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
x = [0, 4, 6, 8, 8, 9, 10, 11, 11, 13]

n = int(input())
ret = 1 if n == 0 else 0
while n:
    ret += x.count(n - (n // 16) * 16)
    n = n // 16
print(ret)


a = int(input())
dirdict = {'0':1,'1':0,'2':0,'3':0,'4':1,'5':0,'6':1,'7':0,'8':2,'9':1,'A':1,'B':2,'C':0,'D':1,'E':0,'F':0}
kals = str(hex(a)).upper()[2:]
ans = 0
for i in kals:
	ans+=dirdict[i]
#print(kals)
print(ans)

def count(x):
    if x=='0' or x=='4' or x=='6' or x=='9' or x=='a' or x=='d': return 1
    if x=='8' or x=='b': return 2
    return 0
print(sum([count(x) for x in hex(int(input(),10))[2:]]))


a=[1,0,0,0,1,0,1,0,2,1,1,2,0,1,0,0]
x=int(input())
b=0
if x == 0:
    b += 1
while x:
    b+=a[x%16]
    x//=16
print(b)

n = hex(int(input()))[2:].upper()
q = n.count('0')*1
q += n.count('4')*1
q += n.count('6')*1
q += n.count('8')*2
q += n.count('9')*1
q += n.count('A')*1
q += n.count('B')*2
q += n.count('D')*1
print(q)


n = str(hex(int(input())))[2:]
nums = [1, 0, 0, 0, 1, 0, 1, 0, 2, 1]
ch = [1, 2, 0, 1, 0, 0]
ans = 0
for i in n:
	if (i >= '0' and i <= '9'):
		ans += nums[ord(i) - ord('0')]
	else:
		ans += ch[ord(i) - ord('a')]
		
print(ans)

a=str(hex(int(input())))
b=0
for i in range(2,len(a)):
    if a[i]=="0" or a[i]=="4" or a[i]=="6" or a[i]=="9" or a[i]=="a" or a[i]=="d":
        b+=1
    elif a[i]=="8" or a[i]=="b":
        b+=2
print(b)


v=[1,0,0,0,1,0,1,0,2,1,1,2,0,1,0,0]
n=int(input())
a=1 if n==0 else 0
while n>0:
  a+=v[n%16]
  n//=16
print(a)


a=int(input())
a=str(hex(a))
s=0
for i in range(1,len(a)):
    if a[i] in ['0','4','6','9','a','d']:s=s+1
    if a[i] in ['8','b']:s=s+2
print(s)