#include <bits/stdc++.h>
using namespace std;
int holes[] = {1, 0, 0, 0, 1, 0, 1, 0, 2, 1, 1, 2, 0, 1, 0, 0};
int convert(char ch) {
  if (ch >= '0' && ch <= '9') return ch - '0';
  if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10;
  if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10;
  return 0;
}
int main() {
  int n;
  cin >> n;
  char buf[100];
  sprintf(buf, "%x", n);
  int p = 0;
  int ans = 0;
  while (buf[p]) {
    ans += holes[convert(buf[p])];
    p++;
  }
  cout << ans << endl;
  return 0;
}
