#include <bits/stdc++.h>
using namespace std;
template <typename T>
void sci(T& t) {
  cin >> t;
}
template <typename T, typename... Ts>
void sci(T& t, Ts&... ts) {
  sci(t);
  sci(ts...);
}
int32_t main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int64_t n;
  cin >> n;
  if (n == 0) return cout << 1, 0;
  vector<int64_t> a(16, 0);
  a[0] = a[4] = a[6] = a[9] = a[10] = a[13] = 1;
  a[8] = a[11] = 2;
  int64_t ans = 0;
  while (n > 0) {
    int64_t num = n % 16;
    n /= 16;
    ans += a[num];
  }
  cout << ans;
  return 0;
}
