#include <iostream>
using namespace std;

int main() {
  long long n;
  while(cin >> n){
  int cnt = 0;
  while (n){
    n &= n-1;
    cnt++;
  }
  cout << cnt << "\n";
  }
  return 0;
}
// 64 位输出请用 printf("%lld")

位运算操作n = n & (n-1) 将n的二进制最右边的1去掉,cnt记录执行次数