#include <iostream>
using namespace std;
typedef long long ll ;
int main() {
    ll x;
    cin>>x;
    ll s=0;
    while (x>0) {
     int s1=x%2;
     if(s1==1)s+=1;
     x/=2;
    }
    cout<<s<<endl;
}
// 64 位输出请用 printf("%lld")

其中的s使用int就行,题解里用ll是习惯了,最后那一行“x/=2”可以写成x>>=1,一个是将原数除以2,一个是将原数右移一位,效果是一样的