#include <bits/stdc++.h>
using namespace std;
string strReverse(string strOrigin) {
  long long i;
  string ans;
  for (i = strOrigin.length() - 1; i >= 0; --i) ans += strOrigin[i];
  return ans;
}
string ToRadix(long long iOrig, int iRadixTarget) {
  if (iRadixTarget == 10) return to_string(iOrig);
  if (iRadixTarget <= 1 || iRadixTarget > 36) return "";
  string ans("");
  long long i, iTemp;
  char arrSeed[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
                      'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
                      'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
  i = iOrig % iRadixTarget;
  iTemp = iOrig / iRadixTarget;
  while (iTemp != 0) {
    if (i < 10)
      ans += to_string(i);
    else
      ans += arrSeed[i - 10];
    i = iTemp % iRadixTarget;
    iTemp = iTemp / iRadixTarget;
  }
  if (i < 10)
    ans += to_string(i);
  else
    ans += arrSeed[i - 10];
  return strReverse(ans);
}
int main() {
  ios::sync_with_stdio(false);
  long long iNum, i, nCountCircles = 0;
  string sHex;
  cin >> iNum;
  sHex = ToRadix(iNum, 16);
  for (i = 0; i <= sHex.length() - 1; ++i) {
    switch (sHex[i]) {
      case '0':
        nCountCircles += 1;
        break;
      case '4':
        nCountCircles += 1;
        break;
      case '6':
        nCountCircles += 1;
        break;
      case '8':
        nCountCircles += 2;
        break;
      case '9':
        nCountCircles += 1;
        break;
      case 'A':
        nCountCircles += 1;
        break;
      case 'B':
        nCountCircles += 2;
        break;
      case 'D':
        nCountCircles += 1;
        break;
    }
  }
  cout << nCountCircles;
endapp:
  return 0;
}
