#include <bits/stdc++.h>
using namespace std;
const int MAXN = 50 + 10;
const int MAXM = 1000 + 10;
const int INF = 1000000001;
const int MOD = 1000000007;
int c[300];
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  int a;
  c['0'] = c['4'] = c['6'] = c['9'] = c['a'] = c['d'] = 1;
  c['8'] = c['b'] = 2;
  cin >> a;
  stringstream str;
  str << hex << a;
  string s;
  str >> s;
  int ans = 0;
  for (int i = 0; i < s.length(); i++) ans += c[s[i]];
  cout << ans << endl;
  return 0;
}
