#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  stringstream ss;
  string s;
  ss << hex << n;
  ss >> s;
  int ats = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0' || s[i] == '6' || s[i] == '9' || s[i] == 'a' ||
        s[i] == 'd' || s[i] == '4')
      ats++;
    if (s[i] == 'b' || s[i] == '8') ats += 2;
  }
  cout << ats;
}
