#include <bits/stdc++.h>
using namespace std;
int n;
int cnt;
char s[] = "0123456789ABCDEF";
int solve(int x) {
  cnt = 0;
  if (x == 0) return 1;
  while (x) {
    char c = s[x % 16];
    if (c == '0' || c == '4' || c == '6' || c == '9' || c == 'A' || c == 'D')
      ++cnt;
    if (c == '8' || c == 'B') cnt += 2;
    x /= 16;
  }
  return cnt;
}
int main() {
  while (~scanf("%d", &n)) {
    printf("%d\n", solve(n));
  }
}
