#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  char s[30];
  sprintf(s, "%X", a);
  int ans = 0;
  for (int(i) = (0); (i) < (strlen(s)); i++) {
    switch (s[i]) {
      case '4':
      case '6':
      case '9':
      case '0':
      case 'A':
      case 'D':
        ans++;
        break;
      case '8':
      case 'B':
        ans += 2;
        break;
      default:
        break;
    }
  }
  cout << ans;
  return 0;
}
