143165576
 1919020031
 1204252996
 210637432
 724264821
 1741
 619489590
 1199537418
 1075765759
 747976826
 638486017
 58438190
 1285316221
 186925426
 1180540990
 833393692
 1818960378
 2000000000
 0
 1309028227
 514714359
 624205168
 1795248373
 643201595
 1304312649

14 3 3 4 5 2 4 4 2 4 6 4 3 4 5 3 5 4 1 5 3 4 5 5 8
#include <bits/stdc++.h>
using namespace std;
char s[100];
int i;
void z(int n, int k) {
  int t;
  i = 0;
  while (true) {
    if (n == 0)
      break;
    else {
      i++;
      t = n % k;
      n = n / k;
      if (t >= 10)
        t = t + 55;
      else
        t = t + 48;
      s[i] = t;
    }
  }
}
int main() {
  int give = 0;
  int w;
  cin >> w;
  if (w == 0) {
    cout << 1;
    return 0;
  }
  z(w, 16);
  for (int j = i; j >= 1; j--)
    if (s[j] == '0' || s[j] == '4' || s[j] == '6' || s[j] == '9' ||
        s[j] == 'A' || s[j] == 'D')
      give++;
    else if (s[j] == '8' || s[j] == 'B')
      give += 2;
  cout << give;
  return 0;
}
