#include <bits/stdc++.h>
using namespace std;
const long long N = (int)1e5 + 7;
const int INF = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
void solve() {
  vector<int> bin;
  for (int i = 0; i < 32; i++) {
    bin.push_back(1 << i);
  }
  int n;
  scanf("%d", &n);
  int ans = 0;
  while (n > 0) {
    for (int i = 31; i >= 0; i--) {
      if (n - bin[i] >= 0) {
        n -= bin[i];
        ans++;
      }
    }
  }
  cout << ans;
}
int main() {
  int test = 1;
  while (test--) {
    solve();
  }
}
