#include<iostream>
#include<fstream>
using namespace std;
int flag=1,count=0;
while(flag){
if(flag&n)
count++;
flag=flag<<1;
}
return count;
}
int main(){
ifstream cin("in.txt");
int n;
while(cin>>n)
{
cout<<numOf1(n)<<endl;
}
return 0;
}
#include<fstream>
using namespace std;
//末尾与1做位与运算,如果为1则表明末位是1,否则为0;此末位与10做位与运算,如果为1表明次末位是1,否则为0,倒数第三位。。。
//负数在计算机中补码表示,如-1在32位机中表示:1111 1111 1111 1111 1111 1111 1111 1111(原码为1000 0000 0000 0000 0000 0000 0000 0001)
int numOf1(int n){int flag=1,count=0;
while(flag){
if(flag&n)
count++;
flag=flag<<1;
}
return count;
}
int main(){
ifstream cin("in.txt");
int n;
while(cin>>n)
{
cout<<numOf1(n)<<endl;
}
return 0;
}