#include <bits/stdc++.h>
using namespace std;
int cnt[1000];
int main() {
  int a;
  char num[100];
  cin >> a;
  sprintf(num, "%x", a);
  cnt['0'] = 1;
  cnt['4'] = 1;
  cnt['6'] = 1;
  cnt['8'] = 2;
  cnt['9'] = 1;
  cnt['a'] = 1;
  cnt['b'] = 2;
  cnt['d'] = 1;
  int ans = 0;
  char *p = num;
  while (*p) ans += cnt[*p++];
  cout << ans << endl;
  return 0;
}
