#include <bits/stdc++.h>
using namespace std;
char s[1000001];
int main() {
  int n, v = 0;
  cin >> n;
  sprintf(s, "%X", n);
  for (int i = 0; i < strlen(s); i++) {
    if (s[i] == '0' || s[i] == '4' || s[i] == '6' || s[i] == '9' ||
        s[i] == 'A' || s[i] == 'D')
      v++;
    else if (s[i] == '8' || s[i] == 'B')
      v += 2;
  }
  cout << v << endl;
  return 0;
}
