var
n,k:longint;
i,l:integer;
s:string;
function jz(n:longint):longint;
var x,i,j:longint;
a:array[1..100] of longint;
begin
readln(x);i:=0;
while x>0 do begin
inc(i);
a[i]:=x mod 2;
x:=x div 2;
end;
for j:=i downto 1 do
if a[j]>=10 then jz:=chr(a[j]+55)
else jz:=chr(a[j]);
end;
begin
read(n);
assign(input,'bita.in');
assign(output,'bita.out');
reset(input);
rewrite(output);
k:=jz(n);
str(n,s);
for i:=1 to length(s)-1;
if (s[i]:=s[i+1]) and (s[i]='1') then l:=l+1;
write(l);
close(input);
close(output);
end.