#include<iostream>
#include<cstdio>
using namespace std;
long long n,m,c,k,w,a;
int h[100050];
string ch;
int main()
{
	cin>>n;
	while(n)
	{
		ch=ch+(char)(n%8+'0');
		n=n/8;
	}
	for(int i=0;i<ch.size();i++)
	if(ch[i]=='1')a++;
	cout<<a;
	return 0;
}

#include <iostream>

int main(int argc, char* argv)
{
	unsigned n;
	std::cin >> n;
	unsigned result = 0;
	char res[64];
	itoa(n, res, 8);
	int l = strlen(res);
	unsigned i = 0;
	while (i < l) {
		if (res[i] == '1')
			++result;
		++i;
	}
	std::cout << result;
}

#include<bits/stdc++.h>
using namespace std;
int sum(int n)
{
    if(n==0)return 0;
    return (n%8==1)+sum(n/8);
}
int n;
int main()
{
    cin>>n;
    cout<<sum(n);
    return 0;
}

#pragma comment(linker, "/STACK:36777216")
#define _USE_MATH_DEFINES
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <climits>
#include <cstring>
#include <cmath>
#include <queue>
#include <functional>
#include <cstdio>
#include <cassert>
#include <stack>

#define mp make_pair
#define mt(x,y,z) mp((x), mp((y), (z)))
#define ZERO(x) memset((x), 0, sizeof(x))
#define NEGATE(x) memset((x), 255, sizeof(x))
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;

// globals starts here

int main()
{
#ifdef DEBUGAGA
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#elif defined(CONTEST)
	freopen(CONTEST ".in", "r", stdin);
	freopen(CONTEST ".out", "w", stdout);
#endif

	cin.sync_with_stdio(false);
	int n;
	cin >> n;

	int ans = 0;
	while (n > 0)
	{
		if (n % 8 == 1)
		{
			++ans;
		}
		n /= 8;
	}

	cout << ans << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long a;
    cin >> a;
    int ans=0;
    while(a){
        if(a%8 == 1)++ans;
        a/=8;
    }
    cout << ans << endl;
}

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <map>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <cassert>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <ctime>
#include <limits>

using namespace std;

#define LET(x,a)        ::typeid(a) x(a)
#define IFOR(i,a,b)     for(LET(i,a);i!=(b);++i)
#define EACH(it,v)      IFOR(it,v.begin(),v.end())
#define FOR(i,a,b)      for(int i = (a); i < int(b);i++)
#define REP(i,n)        FOR(i,0,n)
#define SZ              size()
#define PB              push_back
#define PF              push_front
#define V(x)            vector< x >
#define two(X)          (1<<(X))
#define twoL(X)         (((int64)(1))<<(X))
#define contain(S,X)    (((S)&two(X))!=0)
#define containL(S,X)   (((S)&twoL(X))!=0
#define swap(x,y)       x ^=y ^= x^=y
#define ALL(v)          (v).begin(),(v).end()

const double pi = acos(-1.0);
const double eps = 1e-11;
const int oo = 0x3f3f3f3f;
template<class T> inline void checkmin(T &a, T b){ if (b<a) a = b; }
template<class T> inline void checkmax(T &a, T b){ if (b>a) a = b; }
template<class T> inline T sqr(T x){ return x*x; }
typedef pair<int, int> ipair;
template<class T> inline T lowbit(T n){ return (n ^ (n - 1))&n; }
template<class T> inline int countbit(T n){ return (n == 0) ? 0 : (1 + countbit(n&(n - 1))); }
template<class T> inline T gcd(T a, T b) { T c; while (a != 0) { c = a; a = b%a;  b = c; } return b; }
template<class T> inline T mabs(T a) { if (a < 0) return -a; else return a; }

typedef V(int)          VI;
typedef V(VI)           VII;
typedef V(string)       VS;
typedef long long       int64;
typedef long double     LD;
typedef pair<int, int>   PI;

#pragma comment(linker,"/STACK:36777216")

//#define LocalHost
int TEST_TO;
int TEST_FROM;
inline int index(char c) {
	return (c >= 'a' ? c - 'a' : c - 'A') + 1;
}
inline int solve(int testnum)
{
#ifdef LocalHost
	if (testnum < TEST_FROM || testnum > TEST_TO) return -1;
#endif
	int n; scanf("%d", &n);
	int r = 0;
	while (n > 0) {
		if (n % 8 == 1) ++r;
		n /= 8;
	}
	printf("%d\n",r);
	return 0;
}
int main(int argc, char* argv[])
{
#ifdef LocalHost
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	int t = 1;
	if (argc > 1) t = atoi(argv[1]);
	TEST_FROM = 1;
	TEST_TO = t;
	FOR(_t, 1, t + 1) {
		int ret = ::solve(_t);
		if (ret == -1) break;
	}
#ifdef LocalHost
	printf("Time taken : %.10f seconds\n", (1.0f*clock()) / CLOCKS_PER_SEC);
#endif
	return 0;
}

#define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <stack>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <set>
#include <iterator>
#include <memory.h>
#include <vector>
#include <map>
#include <queue>
#include <iomanip>
#include <ctime>
#include <cassert>
#include <complex>
#include <unordered_map>

using namespace std;

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define mp(a, b) make_pair(a, b)
#define sqr(x) ( (x) * (x) )
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define ft first
#define sc second

typedef long long li;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int, int> pii;
typedef pair<int, int> pt;

const int INF = 1e9;
const li INF64 = 1e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-8;
const int MOD = 1000000007;
const int N = 37;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n;
	cin >> n;

	int ans = 0;
	while (n) {
		if (n % 8 == 1) ans++;
		n /= 8;
	}
	cout << ans;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
long long a,ans=0;
int main()
{
    cin>>a;
    while(a)
    {
    	int w=a%8;
    	if(w==1)
    	ans++;
    	a=a/8;
	}
	cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,m,tot=0;
int main()
{
	cin>>a;
	while(a!=0)
	{
		if(a%8==1)
			tot++;
		a/=8;
	}
	cout<<tot<<endl;
	return 0;
}

#include<stdio.h>
int main()
{
	int a,b,n=0;
	scanf("%d",&a);

	while(a>0)
	{
		b=a%8;
		if(b==1)
			n++;
		a/=8;
	}

	printf("%d",n);
}

#include<iostream>
#include<cstdio>
#define LL long long
using namespace std;
int n,ans;
int main() {
    scanf("%d",&n);
    while (n) {
        if (n%8==1)++ans;
        n/=8;
    }
    printf("%d\n",ans);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,js[10],c=0;
	cin>>n;
	do
	{
		if(n%8==1)	c++;
		n=n/8;
	}while(n>0);
	cout<<c;
}

#include<iostream>
using namespace std;
int a,ans;
int main(){
    cin>>a;
    while(a){if(a%8==1) ans++;a/=8;}
    cout<<ans;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
int n,a[10005],b,ans=0;
int main()
{
	cin>>n;
	for(int i=n;i>0;i/=8)
	{
		a[++b]=i%8;
	}
	for(int i=1;i<=b;i++)
	{
		if(a[i]==1) ans++;
	}
	cout<<ans;

	return 0;
}

#include<cstdio>
using namespace std;
int main(){
	int a,ans=0;
	scanf("%d",&a);
	while(a){
		if(a%8==1)ans++;
		a/=8;
	}
	printf("%d",ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,c=0;
    cin>>i;
    while(i>0){
        int b=i%8;
        if(b==1)
            c++;
        i=i/8;
    }
    cout<<c<<"\n";
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int a,sum=0,x;
	cin>>a;
	x=a;
	while(x>0)
	{
		if(x%8==1) sum++;
		x/=8;
	}
	cout<<sum<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,s;
int main()
{
    scanf("%d",&n);
    while(n)
    {
        if(n%8==1)
            s++;
        n/=8;
    }
    cout<<s;
}

#include<iostream>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define ll long long
using namespace std;
ll n,gs;
void in()
{
cin>>n;
}
void work()
{
while(n!=0)
{
if(n%8==1)gs++;
n/=8;
}
}
void out()
{
cout<<gs;
}
int main()
{
  in();
  work();
  out();
  return 0;
}

#include <bits/stdc++.h>

using namespace std;
using LINT = long long int;
using PII = pair<int,int>;

#define PB push_back
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)

int main() {

    int n;
    cin >> n;

    stringstream ss;

    ss << oct << n;

    int cnt = 0;
    for(char c : ss.str())
        cnt += c == '1';

    cout << cnt << endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,cnt;
int main(){
    cin>>a;
    while(a){
        if(a%8==1) cnt++;
        a/=8;
    }
    cout<<cnt;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,s=0;
	cin>>a;
	while(a){
		if(a%8==1)s++;
		a/=8;
	}
	cout<<s<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,ans=0;
	scanf("%d",&n);
	while(n)
	{
		if(n%8==1) ans++;
		n/=8;
	}
	printf("%d\n",ans);
	return 0;
}

#include<bits/stdc++.h>
int main()
{
    int a,sum=0;
    scanf("%d",&a);
    while(a)
    {
        if(a%8==1)
            sum++;
        a/=8;
    }
    printf("%d\n",sum);
    return 0;
}

#include<bits/stdc++.h>
#define TP int
#define Max 100009
using namespace std;
inline TP read(){
    char c=getchar();
    TP x=0;
    bool f=0;
    while(!isdigit(c))f^=!(c^45),c=getchar();
    while(isdigit(c))x=(x<<1)+(x<<3)+(c^48),c=getchar();
    if(f)x=-x;return x;
}
int main(){
    int n=read(),ans=0;
    while(n){
        if(n%8==1){
        	ans++;
        }
        n/=8;
    }
    cout<<ans;
    exit(0);
}

#include <bits/stdc++.h>
using namespace std;
int ans;
int main()
{
    int n;
    cin>>n;
	while(n>0)
	{
		int s=n%8;
		if(s==1)
			ans++;
		n/=8;
	}
	cout<<ans<<endl;
    return 0;
}

#include<cstdio>
int main()
{
    int a,sum=0;
    scanf("%d",&a);
    while(a)
    {
        if(a%8==1)
            sum++;
        a/=8;
    }
    printf("%d\n",sum);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n;
int work(int x)
{
	if(x==0) return 0;
	else return (x%8==1)+work(x/8);
}
int main()
{
	cin>>n;
	cout<<work(n);
	return 0;
}

#include <iostream>
using namespace std;
int main(){

	int i,j=0,k=0,n,q,p;
	cin>>n;
	p=n;
	while(1)
		if(p>0){

			q=p%8;
			p=p/8;
			if(q==1)k++;
//			cout<<q<<" ";
			}
		else break;

	cout<<k<<endl;

}

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <sstream>
#include <set>
#include <stack>
#include <cctype>
#include <map>
using namespace std;
string strReverse(string strOrigin){
	if (strOrigin.length() == 0){
		return "";
	}
	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,nOne=0;
	string iOct;
	cin >> iNum;
	iOct = ToRadix(iNum, 8);
	for (i = 0; i <= iOct.length() - 1; ++i){
		if (iOct[i] == '1')
			++nOne;
	}
	cout << nOne;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n;
int deal(int n)
{
    if(n==0)return 0;
    return (n%8==1)+deal(n/8);
}
int main() {
	int x,a1,a2,ans=0;
	cin>>n;
    cout<<deal(n);
	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int n;
int sum(int x)
{
	if(x==0)return 0;
	else return (x%8==1)+sum(x/8);
}
int main()
{
	scanf("%d",&n);
	printf("%d",sum(n));
	return 0;
}

#include<stdio.h>
int read()
{
    int x=0,y=1;
    char ch=getchar();
    while(ch>'9'||ch<'0')
    {
        if(ch=='-')y=-1;
        ch=getchar();
    }
    while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return x*y;
}
void print(int x)
{
    if(x<10)
    {
        putchar(x+'0');
        return ;
    }
    print(x/10);
    putchar(x%10+'0');
}
int x,ans;
int main()
{
    x=read();
    while(x)
    {
        if((x-(x>>3<<3))==1)ans++;
        x>>=3;
    }
    print(ans);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
string a="01234567";
int n=0,ans=0;
void div(int n)
{
	if(n==0)
	{
		if(n==1)
		{
			ans++;
		}
		cout<<ans;
		return ;
	}
	if(a[n%8]=='1')
	{
		ans++;
	}
	div(n/8);
}
int main()
{
	cin>>n;
	div(n);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,ans=0;
    cin>>a;
    while(a)
    {
        if(a%8==1)
            ans++;
        a/=8;
    }
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,s=0;
    cin>>n;
    while(n>0)
    {
        if((n-1)%8==0) s++;
        n/=8;
    }
    cout<<s;
    return 0;

}

#include<bits/stdc++.h>
using namespace std;
int a,cnt;
int main(){
    cin>>a;
	while(a){
	    if(a%8==1)
			cnt++;
		a/=8;
	}
	cout<<cnt;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,sum=0;
    cin>>n;
    while(n!=0)
    {
        if(n%8==1)
        {
            sum++;
        }
        n=n/8;
    }
    cout<<sum<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,sum=0;
    cin>>n;
    while(n!=0){//进制转换
        if(n%8==1){//在转换中求1的个数
            sum++;
        }
        n/=8;
    }
    cout<<sum;//愉快输出
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,ans;
int main(){
    cin>>n;
    while(n){
        if(n%8==1) ans++;
        n/=8;
    }
    cout<<ans<<endl;
    return 0;
}

#include<iostream>
using namespace std;
int main(){
int n,s=0;
cin>>n;
while(n>0){
if(n%8==1)
s++;
n/=8;
}
cout<<s;
return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int ans=0;
    while(n)
    {
        if(n%8==1) ans++;
        n/=8;
    }
    cout<<ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int n,i,s=0;
    cin>>n;
    while(n>0)
    {
    	if(n%8==1)
    	    s++;
    	n=n/8;
	}
	cout<<s;
}

#include <cstdio>
using namespace std;
int main(){
	int n,ans=0; scanf("%d",&n);
	while(n){if(n%8==1) ans++; n/=8;} printf("%d",ans);
}

#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 20;

int solve(int n)
{
    int idx = 0;
    int arr[N];

    while(n)
    {
        arr[++ idx] = n % 8;
        n /= 8;
    }

    int res = 0;

    for(int i = idx ; i ; -- i)
    {
        if(arr[i] == 1) res ++;
    }

    return res;
}
int main(void)
{

    int n;
    scanf("%d",&n);

    cout << solve(n) << endl;

    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
	int n,ans=0;
int main()
{
	scanf("%d",&n);
	while(n)
	{
		ans+=(n%8==1);
		n/=8;
	}
	printf("%d",ans);
}

#include<cstdio>

using namespace std;
int main()
{
    int a,sum=0;
    scanf("%d",&a);
    while(a)
    {
        if(a%8==1) sum++;
        a/=8;
    }
    printf("%d\n",sum);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,sum=0;
int main()
{
    cin>>n;
    while(n)
    {
        if(n%8==1)
            sum++;
        n/=8;
    }
    cout<<sum;
    return 0;
}

#include<bits/stdc++.h>
#define n 8
int j=0;
int h[1000]={0};
int fbi(int a){
	if(a%n==a){
		j++;
		h[j]=a;
		return 0;
	}

    else{
    	h[j]=a%n;
    	j++;
    	a/=n;
    	return fbi(a);
	}
}
int main(){
	int a;
	int b=0;
	scanf("%d",&a);
	fbi(a);
	for(int i = 0;i <= j;i++){
		if(h[i]==1){
			b++;
		}
	}
	printf("%d",b);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,ans;
int main()
{
	cin>>a;
	while(a)
	{
		if(a%8==1)
			ans++;
		a/=8;
	}
	cout<<ans<<endl;
	return 0;
}

#include<iostream>
#include<fstream>
#include<ctime>
using namespace std;
int n,sum;
int main()
{
	cin>>n;
while(n>0)
{
	if(n%8==1) sum++;
	n/=8;
}
cout<<sum;
    return 0;
}

#include<iostream>
using namespace std;
int main()
{	int n;
	cin>>n;
	int nums=0;
	while(n!=0)
	{
		if(n%8==1)
		nums=nums+1;
		n=n/8;
	}
	cout<<nums;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sc second
#define fr first
#define pb push_back
#define ARRS int(2e6+10)

ll i,j,k,p,mx,l,m,n,c,h,d,N,M,mn,t,a[ARRS],pas,ans,e;
vector<ll> v;
map<ll,bool>fx;

int main(){
    #ifdef KHOKHO
        freopen("in.in","r",stdin);
        freopen("out.out","w+",stdout);
    #endif

    cin>>n;
    while(n>0){
        if(n%8==1)pas++;
        n/=8;
    }
    cout<<pas;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
using namespace std;
int a,g;
string st;
int main()
{
	cin>>a;
	while(a)
	{
		st=char(a%8+48)+st,a/=8;
	}
	for(int i=0;i<st.size();i++)
	g+=(st[i]=='1');
	cout<<g;

	return 0;
}

#include <iostream>
using namespace std;
#define MAXSIZE 33

int itob(int , char *, short);

int main( int argc, char **argv ) {
	char s[MAXSIZE] = {0};
	int n; cin >> n;
	cout << itob(n,s,8) << endl;
	return 0;
}
////111111111222222233333444444555555556666666677777777788888889999999
//// RETURN    : void
//// PARAMETER : unsigned value, char string, char base
//// PURPOSE   : convert integer value to base 'b' and store the
///				 result into the charater string s
//////////////////////////////////////////////////////////////////////
int itob(int n, char s[], short b) {
	static int i=0;
	static int cnt=0;
	if(n!=0) itob(n/b,s,b);
	s[i] = (n%b)+48;
	(s[i++]=='1')?++cnt:cnt;
	s[i]='\0';
	return cnt;
}

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a[10000], num = 0, ans = 0;
	while (n!=0) {
		a[num++] = n%8;

		n /= 8;
	}
	for (int i = 0; i<num; i++) {
		if (a[i] == 1)	ans ++ ;
	}
	cout << ans << endl;
	return 0;
}

#include<iostream>
using namespace std;
long long n,s;
int main()
{
    cin>>n;
    while(n>0)
    {
        if(n%8==1)s=s+1;
        n=n/8;
    }
    cout<<s;
}

#include <iostream>
#include <vector>

using namespace std;
int main(){
	int a;
	cin>>a;
	int sum=0;

	while(a>0){
		if(a%(10-2)==1){
			sum++;
		}
		a/=(10-2);
	}
	cout<<sum<<endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;

	cin>>i;
	j=0;
	while(i) {
		if(i%8==1) j++;
		i/=8;
	}
	cout<<j<<endl;
}

int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}

#include<cstdio>
int main()
{
    int n,ans(0);
    scanf("%d",&n);
    while(n)
    {
        ans+=(n%8==1);
        n/=8;
    }
    return 0*printf("%d",ans);
}

#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,x;

int main(){
	scanf("%d",&n);
	while(n){
		if(n%8==1)x++;
		n/=8;
	}
	printf("%d\n",x);
	//system("pause");
	return 0;
}

/*  */
#include <iostream>
#include <sstream>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <deque>
#include <bitset>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <cctype>
#include <cassert>
#include <functional>
#include <iterator>
#include <iomanip>
using namespace std;
//#pragma comment(linker,"/STACK:102400000,1024000")

#define sti				set<int>
#define stpii			set<pair<int, int> >
#define mpii			map<int,int>
#define vi				vector<int>
#define pii				pair<int,int>
#define vpii			vector<pair<int,int> >
#define rep(i, a, n) 	for (int i=a;i<n;++i)
#define per(i, a, n) 	for (int i=n-1;i>=a;--i)
#define clr				clear
#define pb 				push_back
#define mp 				make_pair
#define fir				first
#define sec				second
#define all(x) 			(x).begin(),(x).end()
#define SZ(x) 			((int)(x).size())
#define lson			l, mid, rt<<1
#define rson			mid+1, r, rt<<1|1
#define getBits(x)		__builtin_popcount(x)
#define getBitIdx(x)	__builtin_ffs(x)

typedef long long LL;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	#ifndef ONLINE_JUDGE
		freopen("data.in", "r", stdin);
		freopen("data.out", "w", stdout);
	#endif

	int n;
	int ans = 0;

	cin >> n;
	while (n) {
		if (n%8 == 1) ++ans;
		n /= 8;
	}
	cout << ans << endl;

	#ifndef ONLINE_JUDGE
		printf("time = %ldms.\n", clock());
	#endif

	return 0;
}

#include<iostream>
using namespace std;

int count = 0;
int fx(int x)
{
	if(x == 0) return count;
	if(x % 8 == 1) count++;
	return fx(x/8);

}

int main(){
	long long int a;
	cin >> a;
	cout << fx(a);
	return 0;
}

// luogu-judger-enable-o2
#include<iostream>
using namespace std;
int main()
{
    int a,sum=0;
    cin>>a;
    while(a)
    {
        if(a%8==1)
            sum++;
        a/=8;
    }
    cout<<sum;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,sum=0;
int main()
{
    cin>>a;
    while(a!=0)
    {
        if(a%8==1)
            sum++;
        a/=8;
    }
    cout<<sum;
    return 0;
}

#include <cstdio>

int main()
{
    int n, sum = 0;
    scanf("%d", &n);
    while(n)
    {
        if(n % 8 == 1)
            sum++;
        n /= 8;
    }
    printf("%d\n", sum);
    return 0;
}

#include <stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int a[32];
	int i=0;
	while(n){
		a[i++]=n%8;
		n/=8;
}
int count=0;
for(int j=0;j<i;j++){
	if(a[j]==1) count++;
}
printf("%d\n",count);
	return 0;
}

#include<iostream>
using namespace std;
long long aa[7]={1,8,64,512,4096,32768,262144};
int main()
{
	long long a,g=0;
	cin>>a;
	for(int i=0;i<7;i++)
	{
		if(a/aa[6-i]==1)g++;
		//cout<<a<<endl;
		a-=aa[6-i]*(a/aa[6-i]);
	}
	cout<<g<<endl;
	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int n,ans;
int main()
{
	scanf("%d",&n);
	while(n)
	{
		int x=n%8;
		if(x==1) ans++;
		n/=8;
	}
	printf("%d",ans);
	return 0;
}

/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define endl "\n"
#define inf 1<<30
#define Pi acos(-1)
#define pb push_back
#define mp make_pair
#define ss stringstream
#define ll long long int
#define linf 100000000000000000
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define bit_cnt(mask) __builtin_popcount(mask)
using namespace std;
template < class T > inline T gcd(T a,T b) {a=abs(a);b=abs(b); if(!b) return a; return __gcd(b,a%b);}
template < class T > inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/__gcd(a,b))*b;}
#define MOD 1000000007
#define MAX 100005

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
	int ans=0;
	while(n)
    {
		if(n%8==1)ans++;
		n/=8;
	}
	cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int n,num=0;
int main()
{
    cin>>n;
    while(n)
    {
        if(n%8==1)num++;
        n/=8;
    }
	cout<<num<<endl;
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <stack>
#include <cmath>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#define TEST cout<<"wwwwwwwwww"<<endl
//%Tourist 23333
using namespace std;

int main()
{
    int x;
    int countt = 0;
    scanf("%d",&x);
    int i,j;
    j = x;
    while(j != 0 )
    {
        i = j % 8;
        if (i == 1)
            countt++;
        j = j / 8;
    }
    printf("%d\n",countt);
    return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int i,j,a,ans=0,x;
    cin>>a;
    while(a!=0){
        x=a%8;
        if(x==1)ans++;
        a/=8;
    }
    cout<<ans;
    return 0;
}

#include"iostream"
#include"cstdio"
int a,sum=0;

int main() {
	scanf("%d",&a);
	while(a) {
		if(a%8==1)
			sum++;
		a/=8;
	}
	printf("%d\n",sum);
	return 0;
}

#include<iostream>
using namespace std;
int a,b;
int main()
{
    cin>>a;
    while(a)
    {
        if(!(~-(a&7)))
        b=-~b;
        a/=8;
    }
    cout<<b;
}

#include<bits/stdc++.h>
using namespace std;
int a,ans;
int main()
{
    cin>>a;
    while(a)
    {
        if(a%8==1)
            ans++;
        a/=8;
    }
    cout<<ans;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,sum=0;
	cin>>n;
	while(n!=0){
		if(n%8==1){
			sum++;
		}
		n/=8;
	}
	cout<<sum;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,ans=0;
	scanf("%d",&a);
	while(a>0){
		ans+=a%8==1;
		a/=8;
	}
	return printf("%d",ans),0;
}

#include<bits/stdc++.h>
int main()
{
    int a,ans=0;
    scanf("%d",&a);
    while(a)
    {
        if(a%8==1)
            ans++;
        a/=8;
    }
    printf("%d\n",ans);
    return 0;
}

#include<iostream>
using namespace std;
int a,b;
int main(){
    cin>>a;
    while(a){
        if(!(~-(a&7))) b=-~b;
        a/=8;
    }
    cout<<b;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,s;
    s=0;
    cin>>a;
    while(a)
    {
        if(a%8==1)
            s++;
        a/=8;
    }
    cout<<s;
}

#include <iostream>
using namespace std;

int main()
{
    int n, ans = 0;
    cin >> n;
    while(n > 0)
    {
        if(n % 8 == 1)
        {
            ans++;
        }
        n /= 8;
    }
    cout << ans << endl;
    return 0;
}

#include<cstdio>
using namespace std;
int main(){
	int n,ans=0;
	scanf("%d",&n);
	while(n>0){
		if(n%8==1){
			ans++;
		}
		n=n/8;
	}
	printf("%d\n",ans);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
const long long a[]={1,8,64,512,4096,32768,262144};
long long n;
int ans,flag;
int main(){
	scanf("%d",&n);
	while(n>0){
		for(int i=6;i>=0;i--)
			for(int j=8;j>=1;j--)
				if(n-j*a[i]>=0&&flag==0){
					if(j==1)ans++;
					n-=j*a[i];
					flag=1;
				}
		flag=0;
	}
	printf("%d\n",ans);
	return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n, ans;
int main(){
	scanf("%d", &n);
	while(n){
		if(n % 8 == 1) ans++;
		n >>= 3;
	}
	printf("%d", ans);
	return 0;
}

#include<cstdio>
using namespace std;
int main()
{
	int a,ans=0;
	scanf("%d",&a);
	while(a)
	{
		if(a%8==1)ans++;
		a/=8;
	}
	printf("%d",ans);
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int n;
int main(int argc, char const *argv[])
{
    cin>>n;
    ll ans = 0;
    while(n)
    {
        if(n%8==1)ans++;
        n/=8;
    }
    cout<<ans<<endl;
	return 0;
}

#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define For(i, k, j) for(int i = (k); i <= (j); i++)
#define INF 2147483647/3
#define ll long long
using namespace std;
inline int read()
{
    int num = 0, flag = 1;
    char c=' ';
    for(;c>'9'||c<'0';c=getchar()) if(c=='-') flag = -1;
    for(;c>='0'&&c<='9';num=(num<<1)+(num<<3)+c-48,c=getchar());
    return num * flag;
}

int main(){
    int a, sum = 0;
    scanf("%d", &a);
    while(a) {
        if(a % 8 == 1) sum++;
        a /= 8;
    }
    printf("%d\n", sum);
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    long long int a;
    cin >> a;
    long long int t = 7;
    long long int b = 1;

    int ans = 0;
    for ( int i = 0 ; i < 11 ; i++ ) {
        if (!( (a & t) ^ b ))
            ans++;
        t <<= 3;
        b <<= 3;
    }

    cout << ans << endl;

    return 0;
}

#include <bits/stdc++.h>
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
using namespace std;
int32_t main(){
long long int n,ans=0;
cin>>n;
while(n){
    if(n%8==1) ans++;
    n=n/8;
}
cout<<ans;
return 0;}

#include<iostream>
using namespace std;
int main()
{
    int n,ans=0;
    cin>>n;
    while(n!=0)
    {
        if(n%8==1)
            ans++;
        n/=8;
    }
    cout<<ans;
    return 0;
}

//I_Love_PNQ
#include <bits/stdc++.h>
using namespace std;
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);cout.tie(NULL);
   long long n; int cnt(0);
   cin >> n;
   while (n > 0){
    if (n%8 == 1){++cnt;}
    n/=8;
   }
   cout <<cnt;
}

#include <bits/stdc++.h>
//#define scanf scanf_s
#define mst(a, v) memset((a), (v), sizeof (a))
using namespace std;

typedef long long ll;
const ll MAXN = (ll)505;
const ll INF = 0x3F3F3F3F3F3F3F3F;
const ll MOD = 1e9 + 7;

int g[MAXN][MAXN];
int vis[MAXN];
map<char, int> tb;

int any2dec(string s, int n) {
	int len = s.size();
	ll ans = 0;
	ll rad = 1;
	for (int i = len - 1; i >= 0; i--) {
		int dig = tb[s[i]];
		if (dig > n) {
			return -INF;
		}
		ans += dig * rad;
		rad *= n;
	}
	return ans;
}

int main() {
	//ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	for (int i = 0; i < 36; i++) {
		if (i < 10) {
			tb[i + '0'] = i;
		}
		else {
			tb[i - 10 + 'a'] = i;
		}
	}
	string n1, n2;
	int tag, rad;
	int n;
	cin >> n;
	int ans = 0;
	while (n) {
		if (n % 8 == 1) {
			ans++;
		}
		n /= 8;
	}
	cout << ans << "\n";
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int n,num=0;
	cin>>n;
	while(n!=0)
	{
		if(n%8==1)
		num++;
		n=n/8;
	}
	cout<<num<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,sum=0;
    cin>>a;
    while(a!=0)
    {
        if(a%8==1)sum++;
        a/=8;
    }
    cout<<sum;
    return 0;
}

#include<stdio.h>
	int main()
	{   int a,m=0;
	scanf("%d",&a);
	for(;a>7;a/=8){
        if(a%8==1)
            m++;
	}
	printf("%d",m);
	return 0;

	}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    char x;
    int n;
    cin >> n;
    x=n;
    while(x<0) x+=128;
    cout << (int)x << endl;
}

#include<iostream>
using namespace std;

int count = 0;
int fx(int x)
{
	if(x == 0) return count;
//	if(x % 8 == 1) count++;
	return fx(x/8);

}

int main(){
	long long int a;
	cin >> a;
	cout << fx(a);
	return 0;
}

#include <bits/stdc++.h>

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)
#define PB push_back
#define MP make_pair
#define ST first
#define ND second

using namespace std;

typedef long long int LLI;
typedef pair < int , int > PII;
typedef pair < LLI , LLI > PLL;

typedef vector < int > VI;
typedef vector < bool > VB;
typedef vector < PII > VP;
typedef vector < LLI > VL;
typedef vector < PLL > VPL;

typedef vector < VI > VVI;
typedef vector < VL > VVL;
typedef vector < VB > VVB;
typedef vector < VP > VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const LLI LLINF = 1000000000000000001LL;

/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);

    int n;
    cin >> n;

    int cnt = 0;
    while (n > 0) {
        if (n%16 == 1) {
            cnt++;
            n /= 16;
        } else {
            break;
        }
    }

    cout << cnt;

    return 0;
}

/*************************************************************************/

#include<bits/stdc++.h>
using namespace std;
int s,a;
int main()
{
    cin>>a;
    s=0;
    if(a!=0)
    {
    	if(a%8==1)
    	{
    		s++;
    		a/=s;

    	}

    }
	 cout<<s;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll j8_1(ll n){
	return ((n==0)?0:(j8_1(n/8)+(n%8==1)?1:0));
}
int main(){
	ll n;
	scanf("%lld",&n);
	printf("%lld",j8_1(n));
	return 0;
}

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <vector>

using namespace std;

#define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++)
#define FORD(prom, a, b) for(int prom = (a); prom > (b); prom--)
#define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--)

#define DRI(a) int a; scanf("%d ", &a);
#define DRII(a, b) int a, b; scanf("%d %d ", &a, &b);
#define DRIII(a, b, c) int a, b, c; scanf("%d %d %d ", &a, &b, &c);
#define DRIIII(a, b, c, d) int a, b, c, d; scanf("%d %d %d %d ", &a, &b, &c, &d);
#define RI(a) scanf("%d ", &a);
#define RII(a, b) scanf("%d %d ", &a, &b);
#define RIII(a, b, c) scanf("%d %d %d ", &a, &b, &c);
#define RIIII(a, b, c, d) scanf("%d %d %d %d ", &a, &b, &c, &d);

#define PB push_back
#define MP make_pair

#define ff first
#define ss second
#define vi vector<int>
#define pii pair<int,int>

#define ll long long
#define ull unsigned long long

#define MM(co, cim) memset((co), (cim), sizeof((co)))

#define DEB(x) cerr << ">>> " << #x << " : " << x << endl;

int main ()
{
  DRI(a);
  cout << (a&0x7F) << endl;
  return 0;
}

#include <iostream>
#include <vector>

using namespace std;
int main(){
	int a;
	cin>>a;
	while(a>=10){
		a/=10;
	}
	cout<<a<<endl;

	return 0;
}

#include <bits/stdc++.h>
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
using namespace std;
int32_t main(){
long long int n,ans=0;
cin>>n;
while(n){
    if(n%8==0) ans++;
    n=n/8;
}
cout<<ans;
return 0;}

#include<bits/stdc++.h>
using namespace std;
int a=0;
int jinzhi(int b)
{
	if(b<8&&b!=1) return a;
	if(b<8&&b==1) return a=a+1;
	else
	{
		if(b%8==1) a=a+1;
		b=b/8;
	}
}
int main()
{
	int n;
	cin>>n;
	jinzhi(n);
	cout<<a;
	return 0;
}

#include<cstdio>

int main()
{
	int n;scanf("%d",&n);

	int ans=0;
	while(n) ans+=(n&1),n>>=3;

	printf("%d",ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    cout<<n%8;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,ans=0;
    cin>>a;
    while(a!=0)
    {
    	if(a%8==0) ans++;
    	a/=8;
	}
	cout<<ans;
}

#include<iostream>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#define ll long long
using namespace std;
int n,gs;
void in()
{
cin>>n;
}
void work()
{
while(n!=0)
{
if(n%8==0)gs++;
n/=8;
}
}
void out()
{
cout<<gs;
}
int main()
{
  in();
  work();
  out();
  return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main() {
	string a;
	cin >> a;
	cout << count(a.begin(), a.end(), '1') << endl;
}

#include<cstdio>
int n;
int main()
{
    scanf("%d",&n);
    printf("%d",n%8);
}

#include<iostream>
#include<cstdio>

using namespace std;

int eight(int a)
{
    int b=0;
    int c=1;
    for(;a>0;)
    {
        b+=c*(a%8);
        a/=8;
        c*=10;
    }
    return b;
}

int main()
{
    int a;
    cin>>a;
    eight(a);
    int sum=0;
    for(;a>0;)
    {
        if(a%10==1)
        {
            sum++;
        }
        a/=10;
    }
    cout<<sum<<endl;
    return 0;
}

#include<iostream>
using namespace std;
int f(int n)
{
    int c;
	if(n == 0)
	{
		return 0;
	}
	f(n / 8);
    c = n % 8 == 0 ? c++ : c;
	cout<<c;
}
int main()
{
	int n;
	cin>>n;
	f(n);
}

#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a;
	while(a)
	{
		if(a%8==1)
		b++;
		a/=8;
	}
	cout<<b;
	return 0;

}

#include<cstdio>
int f(int n){
	int ans=0;
	while(n>1){
		if(n%8==1)
			ans++;
		n/=8;
	}
	return ans;
}
int main(){
	int n;
	scanf("%d",&n);
	printf("%d",f(n));
}

#include<iostream>
#include<cstring>

using namespace std;
long long a;

int main(){
	cin >> a;
	int ans=0;
	while(a>1){
		if(a&1) ans++;
		a>>=3;
	}
	cout << ans << endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll a[10010],n,i,b[10010],k;
int main(){
    scanf("%d",&n);
    while(n>=8){
        a[i]=n%8;
        n/=8;
        i++;
    }
    k=0;
    for(ll j=i;j>=0;j--){
        if(a[j]==1)k++;
    }
    printf("%d",k);
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll inf = 1e+9 + 7;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n, i = 0, j;
	string s;
	cin >> n;
	for (; n; n /= 16)
		if ((n % 16) == 1)
			++i;
	cout << i;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long A,ans;
int main(){
	cin>>A;
	while(A!=0){
		if(A%8==1) ans++;
		A/=8;
	}
	cout<<A;
	return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
int main(){
	int a,b=0;
	cin>>a;
	for(int i=1;i<=a;i++){
		if(a==0)break;
		if(a%8==1)b++;
		a=a/8;
	}
	cout<<b<<endl;
	return 0;
}

#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

static char cpu[30000];
typedef unsigned long long Int;
int main(int argc, char **argv)
{
Int n;
    cin>>n;
    Int ans=0;
    Int pow=1;
    while(n>0)
    {
        if(n%8==2)
        {
            ans++;
        }
        n=n/8;
    }
    cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;
int a,s=0;
int main()
{
	cin>>a;
	while(a)
	{
		if(a%8==0) s++;
		a/=8;
	}
	cout<<s;
}

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int n;
    cin>>n;
    cout<<1;
    return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a;
    cin>>a;
    int ans=0;
    while(a/8!=0)
    {
        if(a%8==1)
            ans++;
        a=a/8;
    }
    cout<<ans;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a;
	cin>>a;
	int i=0;
	int a1[11];
	while(a!=0)
	{
		a1[i]=a%10;
		a/=10;
		i++;
	}
	int min=a1[0];
	for(int k=1;k<i;k++)
		if(min>a1[k])
			min=a1[k];
	if(i<=1)
	cout<<0;
	else cout<<min;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,ans=0;;
	cin>>n;
	while(n>0)
	{
		int i=n%2;
		if(i==1) ans++;
		n/=2;
	}
	cout<<ans-1<<endl;
	return 0;
 }

#include<cstdio>
int a;
int main()
{
	scanf("%d",&a);
	printf("%o\n",a);
}

#include<iostream>
using namespace std;
int main()
{
	int n,m,t=0;
	cin>>n;
	while(n>7)
	{
		m=n%8;
		if(m==1)
		{
			t++;
			n=n/8;
		}
		else
		n=n/8;
	}
	cout<<t;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main (){
	int a,b;
	b=0;
	cin >> a;
	if(a%8==1)
	b++;
	cout << b;
	return 0;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,sum(0);
	scanf("%d",&a);
	while(a)
	{
		if(a%8==1)
		sum+=1;
		a<<=3;
	}
	printf("%d",sum);
	return 0;
}

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
int main(){
	long long a,b=0;
	cin>>a;
	for(int i=1;i<=a;i++){

		if(a%8==1){
			b++;
			a=a/8;
		}
		else if(a==0)break;
		else a=a/8;
	}
	cout<<b<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sc second
#define fr first
#define pb push_back
#define ARRS int(2e6+10)

ll i,j,k,p,mx,l,m,n,c,h,d,N,M,mn,t,a[ARRS],pas,ans,e;
vector<ll> v;
map<ll,bool>fx;

int main(){
    #ifdef KHOKHO
        freopen("in.in","r",stdin);
        freopen("out.out","w+",stdout);
    #endif

    cout<<1;
}

#include<bits/stdc++.h>
using namespace std;
int s,a;
int main()
{
    cin>>a;
    s=0;
    if(a!=0)
    {
    	if(a%8==1)
    	{
    		s++;
    		a/=5;

    	}

    }
	 cout<<s;

    return 0;
}

#include<iostream>

using namespace std;

int main()
{
	int a,ans;
	cin>>a;
	while(a)
	{
		if(a%8==1)ans++;
		a/=8;
	}
	cout<<ans;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define re return
#define y0 y2415
#define y1 y346246
#define j0 j23562456
#define j1 j245623456
#define sqrt(x) sqrt (abs (x))

typedef unsigned long long ull;
typedef long long ll;
typedef double D;
typedef long double ld;
typedef pair <int, int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <vi> vvi;
typedef vector <string> vs;

template <class T> T gcd (T a, T b) { re a ? gcd (b % a, a) : b; }
template <class T> T abs (T x) { re x > 0 ? x : -x; }
template <class T> T sqr (T x) { re x * x; }
template <class T> int sgn (T x) { re x > 0 ? 1 : (x < 0 ? -1 : 0); }

const ld pi = acos (-1.0);

int n;
int m;

int main()
{
    cin >> n;
    cout << n % 8 << endl;
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int a,b=0;
    cin>>a;
    while(a>0)
    {
        if((a-1)%8==0)a++;
        a/=8;
    }
    cout<<b;
    return 0;
}

#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a;
	while(a)
	{
		if(a%8==1)
		b++;
		a/=8;
	}
	cout<<b;
	return 0;

}

#include <bits/stdc++.h>

using namespace std;
using LINT = long long int;
using PII = pair<int,int>;

#define PB push_back
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)

int main() {

    int n;
    cin >> n;

    stringstream ss;

    ss << oct << n;

    cout << ss.str().back() << endl;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int ans=0;
    while(n)
    {
        ans+=(n%10==1);
        n/=10;
    }
    cout << ans << endl;
}

// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
long long n,sum=0;
int main()
{
	cin>>n;
	while(n!=0)
	{
		if(n%10==1)sum++;
		n/=10;
	}
	cout<<sum<<endl;
	return 0;
}

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <cassert>

#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <numeric>

#include <unordered_set>

using namespace std;

typedef long long int64;
typedef unsigned long long uint64;
typedef double float64;

template<typename T> T sqr(T x) { return x*x; }
#define mp make_pair
#define pb push_back
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define forr(i, n) for(int i = int(n) - 1; i >= 0; i--)
#define forit(i,c) for(i=(c).begin(); i!=(c).end(); i++)
#define all(x) (x).begin(), (x).end()
#define zero(a) memset((a), 0, sizeof(a))

typedef vector<int> vint;
typedef vector<bool> vbool;
typedef vector<int64> vint64;
typedef pair<int, int> pii;
typedef pair<int64, int64> pii64;

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif

	int64 n;
	cin >> n;

	vint v;
	while (n)
	{
		v.push_back(n % 8);
		n /= 8;
	}

	v.resize(min((int)v.size(), 1));
	reverse(all(v));

	int64 res = 0;
	forn(i, v.size())
	{
		res *= 10;
		res += v[i];
	}

	cout << res << endl;

	return 0;
}

#include<stdio.h>
int main()
{
    int a,sum=0;
    scanf("%d",&a);
    while(a)
    {
        if(a%8==0)
            sum++;
        a/=8;
    }
    printf("%d\n",sum);
    return 0;
}

#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int main ()
{
    int n, s=0;
    scanf("%d",&n);
    while (n>0){
    	if(n%8==1) s++;
    	n/=10;
	}
	printf("%d",s);
    return 0;
}

#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <utility>
#include <iostream>
using namespace std;

typedef long long int LL;
#define N 100000+100
int a[N];
int main() {
	int n;
	int num = 0;
	cin >> n;
	while (n/8!=0) {
		a[num++] = n%8;
		n /= 8;
	}
	int ans = 0;
	for (int i = 0; i<num; i++) {
		if (a[i] == 1)	ans ++ ;
	}
	cout << ans << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
	cin>>n;
	int num=0;
	if(n%8==1) num++;
	n=n/8;
	cout<<num;
}

#include<assert.h>
#include<ctype.h>
#include<errno.h>
#include<float.h>
#include<iostream>
#include<limits.h>
#include<locale.h>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<wctype.h>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<complex.h>
#include<fenv.h>
#include<inttypes.h>
#include<stdbool.h>
#include<stdint.h>
#include<tgmath.h>
#include<fstream>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#define INF 1<<30
using namespace std;
inline void read(long long &x)
{
	char ch=getchar();x=0;
	for(;ch<'0'||ch>'9';ch=getchar());
	for(;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
}
inline void write(long long x)
{
    char F[200];
    int tmp=x>0?x:-x ;
    if(x<0)putchar('-') ;
    int cnt=0 ;
       while(tmp>0)
       {
           F[cnt++]=tmp%10+'0';
           tmp/=10;
       }
       while(cnt>0)putchar(F[--cnt]);
}
const int MMAAXXNN = 200;
struct bign
{
  int len, s[MMAAXXNN];
  bign(){memset(s, 0, sizeof(s));len = 1;}
  bign(int num) {*this = num;}
  bign(const char* num) {*this = num;}
  bign operator = (int num) {char s[MMAAXXNN];sprintf(s, "%d", num);*this = s;return *this;}
  string str() const {string res = "";for(int i = 0; i < len; i++) res = (char)(s[i] + '0') + res;if(res == "") res = "0";return res;}
  void clean() {while(len > 1 && !s[len-1]) len--;}
  bign operator = (const char* num) {len = strlen(num);for(int i = 0; i < len; i++) s[i] = num[len-i-1] - '0';return *this;}
  bign operator + (const bign& b) const{
  bign c;c.len = 0;for(int i = 0, g = 0; g || i < max(len, b.len); i++) {int x = g;if(i < len) x += s[i];if(i < b.len) x += b.s[i];c.s[c.len++] = x % 10;g = x / 10;}return c;}
  bign operator * (const bign& b) {bign c; c.len = len + b.len;for(int i = 0; i < len; i++)for(int j = 0; j < b.len; j++)c.s[i+j] += s[i] * b.s[j];for(int i = 0; i < c.len-1; i++){c.s[i+1] += c.s[i] / 10;c.s[i] %= 10;}c.clean();return c;}
  bign operator - (const bign& b) {bign c; c.len = 0;for(int i = 0, g = 0; i < len; i++) {int x = s[i] - g;if(i < b.len) x -= b.s[i];if(x >= 0) g = 0;else {g = 1;x += 10;}c.s[c.len++] = x;}c.clean();return c;}
  bool operator < (const bign& b) const{if(len != b.len) return len < b.len;for(int i = len-1; i >= 0; i--)if(s[i] != b.s[i]) return s[i] < b.s[i];return false;}
  bool operator > (const bign& b) const{return b < *this;}
  bool operator <= (const bign& b) {return !(b > *this);}
  bool operator == (const bign& b) {return !(b < *this) && !(*this < b);}
  bign operator += (const bign& b) {*this = *this + b;return *this;}
};
istream& operator >> (istream &in, bign& x) {string s;in >> s;x = s.c_str();return in;}
ostream& operator << (ostream &out, const bign& x) {out << x.str();return out;};
bool isprime(int n)
{
    if(n==1) return false;
    if(n==2||n==3) return true;
    if(n%6!=1&&n%6!=5) return false;
    for(register int i=5;i*i<=n;i+=6)
        if(n%i==0||n%(i+2)==0) return false;
    return true;
}
int n;
int go(int x)
{
	if(x==0) return 0;
	return go(x/8)+x%8==1?1:0;
}
int main()
{
    std::ios::sync_with_stdio(false);
    scanf("%d",&n);
    printf("%d\n",go(n));
    return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
long long k=12345678;
	long long t=1,n;
void fn(long long x){
	if(x>0) fn(x/2);
	t=t*t%k;
	if(x%2==1) t=t*2%k;
}
int main(){
	freopen("Peach.in","r",stdin);
	freopen("Peach.out","w",stdout);
	cin>>n;
	fn(n-1);
	printf("%lld",(3*t-2)%k);
	return 0;
}

/*******************************\
   Name:    REAJUL HAQUE REAYZ  |
   School:  COMILLA UNIVERSITY  |
            CSE (5TH BATCH)     |
********************************/
#include<bits/stdc++.h>
#define endl "\n"
#define inf 1<<30
#define Pi acos(-1)
#define pb push_back
#define mp make_pair
#define ss stringstream
#define ll long long int
#define linf 100000000000000000
#define all(v) v.begin(), v.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define bit_cnt(mask) __builtin_popcount(mask)
using namespace std;
template < class T > inline T gcd(T a,T b) {a=abs(a);b=abs(b); if(!b) return a; return __gcd(b,a%b);}
template < class T > inline T lcm(T a,T b) {a=abs(a);b=abs(b); return (a/__gcd(a,b))*b;}
#define MOD 1000000007
#define MAX 100005

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n; cin>>n;
    if(n<=765) cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}

#define	_CRT_SECURE_NO_WARNINGS
#define	_USE_MATH_DEFINES
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <functional>

using namespace std;

#define ft  first
#define sd  second
#define mp  make_pair
#define	pb	push_back

typedef long long int   ll;
typedef double     ld;
typedef	pair<int, int>	ii;
typedef	vector<int>		vi;
typedef	vector<ii>		vii;

const int MAXN = 100;
const int MAXM = 200000;
const int INF = 1000000010;
const ll MOD = 1000000007;
const ll P = 31;
const ld EPS = 1e-6;

int A;

int main() {
#ifdef  FILE_IO
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("happy.in", "r", stdin);
	//freopen("happy.out", "w", stdout);
#endif // FILE_IO
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	scanf("%d", &A);
	int n = 0;
	while (A) {
		if (A % 10 == 1)
			n++;
		A /= 10;
	}
	printf("%d", n);

	return 0;
}

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
string ai="0123456789ABCDEF";
int cont;
void qaq(long long n,int k);
int main()
{
	int shu;
	shu=10;
 string yuanzijing;
 cin>>yuanzijing;
	int yao;
	yao=8;
	long long all=0;
	int ttt=yuanzijing.size();
	for(int q=0;q<yuanzijing.size();q++)
	{
		if(yuanzijing[q]>='0'&&yuanzijing[q]<='9')
		{

			all+=(yuanzijing[q]-'0')*pow(shu,--ttt);
		}
		else
		{
			all+=(yuanzijing[q]-'A'+10)*pow(shu,--ttt);
		}
	}
	qaq(all,yao);
	cout<<cont;
}
void qaq(long long n,int k)

{
int temp;
temp=n%k;
n/=k;
if(n!=0)
qaq(n,k);
if(temp==2) cont++;
}

#include<bits/stdc++.h>
using namespace std;
int n,ans;
int main()
{
	scanf("%d",&n);
	while(n>=8){
		if(n%8==1)
		ans++;
		n/=8;
	}
	printf("%d",ans);
	return 0;
}

#include <algorithm>
#include <iostream>
#include <string.h>
#include <cstring>
#include <math.h>
#include <vector>
#include <utility>
#include <cstdlib>
#include <deque>
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <windows.h>
#include <cmath>
#include <fstream>
#include <list>
#define LD ld
#define LL ll
#define ULL ull
#define pow(a, b) pow((ld)a, (ld)b)
#define push_back pb

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef unsigned int uint;

const int nn = (int)2000000;
const ld eps = 3 * 10e-8;
const ld eps1 = 5 * 10e-8;
const ull INF = (ull)(1e19 * 1.7);
const ull mod = 1000000007;

using namespace std;

int main()
{
	int a;
	cin >> a;
	cout << a % 8;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,ans=0;
    cin>>a;
    while(a!=0)
    {
    	if(a%8==0) ans++;
    	a/=8;
	}
	cout<<ans;
}

#pragma GCC optimize(2)
#include<algorithm>
#include<iostream>
using namespace std;
int sum(int n)
{
	if(n==0)return 0;
	return n%8==1+sum(n/8);
}
int n;
int main()
{
	ios::sync_with_stdio(0);
	cin>>n;
	cout<<sum(n);
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#define re read()
using namespace std;
inline int read() {
    int ret=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9') {if (ch=='-') f=-f;ch=getchar();}
    while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
    return ret*f;
}
int main() {
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	long long n;
	long long tot=0;
	cin>>n;
	while(n) {
		if(n%8==0) tot++;
		n/=8;
	}
	cout<<tot;
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin >> n;
	cout << n%8;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int s,a;
int main()
{
    cin>>a;
    s=0;
    if(a!=0)
    {
    	if(a%8==1)
    	{
    		s++;
    		a/=s;

    	}

    }
	 cout<<s;

    return 0;
}

#include <bits/stdc++.h>

#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define in(x) int (x); input((x));
#define x first
#define y second
typedef int itn;

//#define next next12345
//#define prev prev12345
#define left lefdsf232
#define right rig43783
#define x1 x12345
#define y1 y12345

using namespace std;

template<typename T>
T gcd(T x, T y) {
    while (y > 0) {
        x %= y;
        swap(x, y);
    }
    return x;
}

template<class T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

template<class _T>
inline _T sqr(const _T &x) {
    return x * x;
}

template<class _T>
inline string tostr(const _T &a) {
    ostringstream os("");
    os << a;
    return os.str();
}

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
const ld PI = 3.1415926535897932384626433832795L;

template<typename T>
inline void input(T &a) {
    static int ed;
    a = 0;
    while (!isdigit(ed = getchar()) && ed != '-') { }
    char neg = 0;
    if (ed == '-') {
        neg = 1;
        ed = getchar();
    }
    while (isdigit(ed)) {
        a = 10 * a + ed - '0';
        ed = getchar();
    }
    if (neg) a = -a;
}

template<typename T = int>
inline T nxt() {
    T res;
    input(res);
    return res;
}

void myassert(bool v) {
    assert(v);
    //cout << "FAIL\n";
    //exit(0);
}

mt19937 generator;

bool check(int v) {
    if (v < 2) return false;
    for (int i = 2; i * i <= v; ++i) {
        if (v % i == 0) {
            return false;
        }
    }
    return true;
}

long long pw(long long a, long long n, long long m) {
    ll res = 1;
    while (n) {
        if (n & 1ll) {
            res = res * a % m;
        }
        a = a * a % m;
        n >>= 1;
    }
    return res;
}

long long inv(long long a, long long p) {
    long long res = 1;
    while (a > 1) {
        res = res * (p - p / a) % p;
        a = p % a;
    }
    return res;
}

long long mod = 1000000007;

void solve(int test) {

    int n = nxt();
    cout << __builtin_popcount(n - 1) << "\n";
}

void pre() {

}

int main(int argc, char ** argv) {

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#else
    #define fname "sequence"
    //freopen(fname".in", "r", stdin);
    //freopen(fname".out", "w", stdout);
#endif
    pre();
    int t = 1;

#ifdef LOCAL
#else
#endif
    int c = 0;
    while (t--) {
        solve(++c);
    }

#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC * 1000 << " ms." << endl;
#endif
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,cnt;
    cnt=0;
    scanf("%d",&n);
    while(n){if(n%8)cnt++;n/=8;}
    printf("%d\n",cnt);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int num=0;
	if(n%8==1) num++;
	n=n/10;
	cout<<num;
}

#include <iostream>
using namespace std;
int main(){
	int _;
	cin>>_;
	int __=0;
if(_==1)__++;
	for(;_/=8;){
		if(_%8==1)__++;
	}
	cout<<__;
	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll inf = 1e+9 + 7;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n, i = 0, j;
	string s;
	cin >> n;
	for (; n; n /= 10)
		if ((n % 10) == 1)
			++i;
	cout << i;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define trav(a, x) for (auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
void PR(vi &v) { trav(x, v) cout << x << ' '; cout << endl; }

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	// vi b8;
	int res = 0;
	while (N) {
		int a = N & 7;
		if (a == 0) res++;
		N /= 8;
	}
	cout << res << endl;
}

#include<iostream>

using namespace std;
long long a;

int main(){
	cin >> a;
	int ans=0;
	while(a>1){
		if(a&1) ans++;
		a>>=3;
	}
	cout << ans << endl;
	return 0;
}

#include <iostream>
#include <vector>

using namespace std;
int main(){
	int a;
	cin>>a;
	cout<<1<<endl;

	return 0;
}

#include <iostream>
#include <fstream>
#include <list>
#include <stack>
#include <deque>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define snp string::npos

int main()
{
    ll a,r=0;
	cin>>a;
	while(a)
	{
        r+=(a%8);
		a/=8;
	}
	cout<<r<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int a;
	cin >> a;

	cout << a%2 << endl;
}

#include <cstdio>
using namespace std;
int n,nr;
char c;
int main()
{
    scanf("%d",&n);
    while(n>0)
    {
        if(n%8==0)
            nr++;
        n/=8;
    }
    printf("%d",nr);

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
#define debug( fmt, ... ) \
        fprintf( stderr, \
                  fmt "\n", \
                  ##__VA_ARGS__ \
        )

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1 << 29;
const double EPS = 1e-10;

double zero(double d) {
    return d < EPS ? 0.0 : d;
}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
    os << '[';
    rep(i, a.size()) os << (i ? " " : "") << a[i];
    return os << ']';
}

string toString(int i) {
    stringstream ss;
    ss << i;
    return ss.str();
}

const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
    ll res = 1ll;
    ll x = a;
    while (k != 0) {
        if ((k & 1) == 1)
            res = (res * x) % M;
        x = (x * x) % M;
        k >>= 1;
    }
    return res;
}

struct prepare {
	prepare() {
	    cout.setf(ios::fixed, ios::floatfield);
	    cout.precision(8);
	    ios_base::sync_with_stdio(false);
	}
} _prepare;

int main() {
    int a;
    cin >> a;

    cout << a % 8 << endl;

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main (){
	int a,b;
	b=0;
	cin >> a;
	if(a%8==1)
	b++;
	cout << b;
	return 0;

}

#include <iostream>

using namespace std;

int main()
{
    int n, k;
    cin >> n;
    while (n != 0) {
        if (n % 8 == 1) k++;
        n /= 8;
    }
    cout << k;
    return 0;
}

#include<iostream>
using namespace std;
int asr;
void turn8(int x)
{
	if(x<8)
	  return;
	if(x%8==1)
	  asr++;
	x/=8;
	turn8(x);
}
int main()
{
	int a;
	cin>>a;
	turn8(a);
	cout<<asr;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int s,a;
int main()
{
    cin>>a;
    s=0;
    if(a!=0)
    {
    	if(a%8==1)
    	{
    		s++;
    		a/=8;

    	}
    	cout<<s;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,ans=0;
int main()
{
	scanf("%d",&a);
	while(a!=0)
	{
		if(a%8==0)
		ans++;
		a/=8;
	 }
	 printf("%d",ans);
	return 0;
 }

// Template v2
#define pb push_back
#define mp make_pair
#define first x
#define second y
#define l(x) x<<1
#define r(x) x<<1 | 1
#define lsb(x) x & -x
#include<bits/stdc++.h>
#include <bitset>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PKK;
// primes less than 100
const int PRIM[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
const int CMAX = 10005;
const int MOD = 666013;
const int NMAX = 1e6;
const short INF16 = 32000;
const int INF = 1e9 + 10;
const LL INF64 = LL(1e18);
const LD EPS = 1e-9, PI = acos(-1.0);

int rs;int n;
int read()
{
    cin>>n;
    while(n)
    {
        if(n%10==1)
            rs++;
        n/=10;
    }
    cout<<rs;

}

int main(){

    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cout << setprecision(12) << fixed;
    read();

    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        printf("1\n");
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a,c=0;
int main()
{
    cin>>a;
    if(a%8==1)
      c++;
	  a/=8;
	  cout<<c;

    return 0;
}

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
#define MAXN 10

char s[MAXN];

int main()
{
	scanf("%s",s);
	int sum=1;
	for(int i=1;i<7;i++){
		if(s[i]=='1'&&s[i+1]=='0'){
			sum+=10;i++;
		}
		else{
			sum+=s[i]-'0';
		}
	}
	printf("%d\n",sum);
}

#include<bits/stdc++.h>
using namespace std;
int a=0;
int jinzhi(int b)
{
	if(b<8&&b!=1) return a;
	if(b<8&&b==1) return a=1;
	else
	{
		if(b%8==1) a=a+1;
		b=b/8;
	}
}
int main()
{
	int n;
	cin>>n;
	jinzhi(n);
	cout<<a;
	return 0;
}

#include<iostream>
#include<cstring>

using namespace std;
long long a;

int main(){
	cin >> a;
	int ans=0;
	while(a>1){
		if(a&1) ans++;
		a>>=3;
	}
	cout << ans << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#ifdef ONLINE_JUDGE
#define OJ 1
#else
#define OJ 0
#endif

#define dd				double
#define ll 				long long
#define pb 				push_back
#define mp 				make_pair
#define X				first
#define Y				second
#define forn( i, n ) 	for( ll i = 0; i < (ll) (n); i ++ )
#define endl 			'\n'

#define TIMESTAMP fprintf(stderr, "Execution time: %.3lf s.\n", (double)clock()/CLOCKS_PER_SEC)

struct __s { __s() {
		srand( time( NULL ) );
		//freopen( "input.txt", "r", stdin ); freopen( "output.txt", "w", stdout );
		if( OJ ) { ios_base::Init i; cin.sync_with_stdio( 0 ); cin.tie( 0 ); }
	} ~__s() {
		if( !OJ ) TIMESTAMP;
		ll n; cin >> n;
	}
} __S;

int main( void ) {
	ll n;
	cin >> n;
	cout << n % 4 << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int N,ans;
int main(){
    scanf("%d",&N);
    while(N){
        if(N%8==1) ans++;
        N/=8;
    }
    printf("%lld\n",ans);
    return 0;
}

//////////////////////////
// IN THE NAME OF GOD   //
//////////////////////////

#include <bits/stdc++.h>
using namespace std;

typedef long long int lld;
typedef long double ldb;

int main(){

	int n;
	cin >> n;
	cout << n%8 ;
}

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<cmath>
#include<bitset>
#include<cassert>
#include<queue>
#include<stack>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	int n;
	scanf("%d", &n);
	int ans = 0;
	while (n > 0)
	{
		if (n % 10 == 1)
		{
			ans++;
		}
		n /= 10;
	}
	printf("%d\n", ans);
}

#include<bits/stdc++.h>
using namespace std;
int dg(int x){
	if(x==0)
		return 0;
	if(x%8==0) return dg(x/8)+1;
	else return dg(x/8);
}
int main(){
	int x;
	cin>>x;
	cout<<dg(x)<<endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin >> n;
	cout << n%8;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	int n,ans=0;;
	cin>>n;
	while(n>0)
	{
		int i=n%2;
		if(i==1) ans++;
		n/=2;
	}
	cout<<ans-1<<endl;
	return 0;
 }

#include<bits/stdc++.h>
using namespace std;

int a[600];

int main()
{
	int t=0;
	string s;
	cin>>s;
	a[0]=s.length();
	for(int i=1;i<=a[0];++i)
	    a[i]=s[a[0]-i]-'0';
	for(int i=1;i<=a[0];++i)
	{
		if(a[i]==1) t++;
	}
	cout<<t;
	return 0;
}

#include<iostream>
using namespace std;

int count = 0;
int fx(int x)
{
	if(x == 0) return count;
//	if(x % 8 == 1) count++;
	return fx(x/8);

}

int main(){
	long long int a;
	cin >> a;
	cout << fx(a);
	return 0;
}

// * (Ah, the cactus. Truly the most tsundere of all plants.)
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
typedef long long ll;

int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    int c = n%10;
    if(c<8) cout << c << endl;
    else cout << (c-8) << endl;
    return 0;
}

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<list>
#include<cmath>
#include<bitset>
#include<cassert>
#include<queue>
#include<stack>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	int n;
	scanf("%d", &n);
	int t = n % 10;
	if (t == 0 || t == 1 || t == 2 || t == 3)
	{
		printf("%d\n", t);
	}
	else if (t == 4 || t == 5 || t == 6 || t == 7 || t == 8)
	{
		printf("%d\n", abs(5 - t));
	}
	else
	{
		printf("%d\n", 10 - t);
	}
}