#include <bits/stdc++.h>
using namespace std;
int main() {
  int input, sum = 0;
  cin >> input;
  stringstream s;
  s << hex << input;
  string str;
  s >> str;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '0') sum++;
    if (str[i] == '4') sum++;
    if (str[i] == '6') sum++;
    if (str[i] == '8') sum += 2;
    if (str[i] == '9') sum++;
    if (str[i] == 'a') sum++;
    if (str[i] == 'b') sum += 2;
    if (str[i] == 'd') sum++;
  }
  cout << sum << endl;
  return 0;
}
