#include <bits/stdc++.h>
using namespace std;
string tostring(int x) {
  string t = "";
  t += (char)(x + 48);
  if (x < 10) return t;
  if (x == 10) return "A";
  if (x == 11) return "B";
  if (x == 12) return "C";
  if (x == 13) return "D";
  if (x == 14) return "E";
  if (x == 15) return "F";
}
string tohexa(int x) {
  string temp = "";
  while (x > 0) {
    int r = x % 16;
    x /= 16;
    temp += tostring(r);
  }
  reverse(temp.begin(), temp.end());
  return temp;
}
int solve(string A) {
  int c = 0;
  for (int i = 0; i < A.size(); i++) {
    if (A[i] == '0' || A[i] == '6' || A[i] == '9' || A[i] == 'D' ||
        A[i] == 'A' || A[i] == '4')
      c++;
    if (A[i] == 'B' || A[i] == '8') c += 2;
  }
  return c;
}
int main() {
  int A;
  cin >> A;
  if (A == 0) cout << 1, exit(0);
  string hexa = tohexa(A);
  int ans = solve(hexa);
  cout << ans << endl;
  return 0;
}
