#include <bits/stdc++.h>
using namespace std;
int twopower(long long int n) {
  long long int i = 1, count1 = 0;
  for (i = 1; i <= n; i++) {
    count1 = i;
    if (pow(2, i) > n) {
      break;
    }
  }
  return count1 - 1;
}
int main() {
  long long int n;
  cin >> n;
  int a = n;
  long long int i = 1, count = 0, count2 = 0;
  for (i = 1; i <= n; i++) {
    if (a == pow(2, twopower(a))) {
      count = count + 1;
      break;
    } else {
      a = a - pow(2, twopower(a));
      count2 = count2 + 1;
    }
  }
  cout << count2 + count;
}
