#include <bits/stdc++.h>
using namespace std;
int main() {
  long int decnum, rem, quot;
  int i = 1, j, temp;
  cin >> decnum;
  quot = decnum;
  stringstream ss;
  ss << std::hex << decnum;
  string hexdecnum(ss.str());
  int x = 0;
  for (int p = 0; p < hexdecnum.length(); p++) {
    if (hexdecnum[p] == '0')
      x += 1;
    else if (hexdecnum[p] == '4')
      x += 1;
    else if (hexdecnum[p] == '6')
      x += 1;
    else if (hexdecnum[p] == '8')
      x += 2;
    else if (hexdecnum[p] == '9')
      x += 1;
    else if (hexdecnum[p] == 'a')
      x += 1;
    else if (hexdecnum[p] == 'b')
      x += 2;
    else if (hexdecnum[p] == 'd')
      x += 1;
  }
  cout << x << endl;
  return 0;
}
