#include <bits/stdc++.h>
int holes;
void search(int now) {
  if (now == 6) {
    ++holes;
  } else if (now == 8) {
    holes += 2;
  } else if (now == 9) {
    ++holes;
  } else if (now == 10) {
    ++holes;
  } else if (now == 11) {
    holes += 2;
  } else if (now == 13) {
    ++holes;
  } else if (now == 0) {
    ++holes;
  } else if (now == 4) {
    ++holes;
  }
}
int main() {
  long long n;
  int now;
  scanf("%lld", &n);
  if (n == 0) {
    holes = 1;
  }
  while (n > 0) {
    now = n % 16;
    search(now);
    n /= 16;
  }
  printf("%d\n", holes);
  return 0;
}
