#include <bits/stdc++.h>
int main() {
  int x;
  int c = 0;
  scanf("%d", &x);
  int i, b, j;
  int m = x;
  for (j = 0; m > 1; j++) {
    for (i = 0;; i++) {
      b = 1 << i;
      if (b > m) {
        m = -1 * (1 << (i - 1)) + m;
        break;
      } else if (b == m) {
        m = m - (1 << i);
        break;
      }
    }
    c++;
  }
  if (m == 1) c++;
  printf("%d\n", c);
  return 0;
}
