#include <bits/stdc++.h>
int main() {
  long long a[32];
  a[0] = 1;
  for (int i = 1; i < 32; i++) {
    a[i] = 2 * a[i - 1];
  }
  int n;
  while (~scanf("%d", &n)) {
    int count = 0, flag = 0;
    while (1) {
      for (int i = 0; i < 32; i++) {
        double k = (double)n / a[i];
        if (k == 1) {
          count++;
          flag = 1;
          break;
        }
        if (k >= 1 && k < 2) {
          count += 1;
          n = n - a[i];
        }
      }
      if (flag == 1) break;
    }
    printf("%d\n", count);
  }
  return 0;
}
