n = gets.to_i #n = 10**(10**6) cnt = 0; tmp = 2**(5*10**3) - 1 def pop_count(x) ret = 0 while x>0 do ret += 1 x -= x&-x end return ret end while n>0 do if n&tmp > 0 then cnt += pop_count(n&tmp) end n >>= (5*10**3) end puts cnt