#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int loops = 0;
  int rem = a % 16;
  while (a > 16) {
    if ((rem == 6) || (rem == 9) || (rem == 10) || (rem == 13) || (rem == 0) ||
        (rem == 4))
      loops++;
    if ((rem == 11) || (rem == 8)) loops += 2;
    a = a / 16;
    rem = a % 16;
  }
  if ((a == 6) || (a == 9) || (a == 10) || (a == 13) || (a == 0) || (a == 4))
    loops++;
  if ((a == 11) || (a == 8)) loops += 2;
  cout << loops << endl;
}
