#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef  long long int ll;
typedef short int ss;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define forn(i,n) for(int i = 0; i < n; ++i)
#define forl(i,n) for(long long i=0;i<n;++i)
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define vpi vector<pi>
#define vpl vector<pl>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define all(x) x.begin(),x.end()

int main(){
    fast;
    int x;
    cin>>x;

    int count =0;
    while(x>1){
        if(x%2==0){
            x/=2;
        }
        else{
            x-=1;
            count+=1;
        }
    }
    cout<<count+1<<endl;
}

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

        x/=2;
    }
    cout<<ans+1<<endl;
}

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

int main()
{
    int n,count1 = 0;
    cin>>n;

    bitset<100> b(n);

    cout<<b.count()<<endl;
//    while(n)
//    {
//        if(n & 1)
//            count1++;
//
//        n >>= 1;
//    }
//
//    cout<<count1<<endl;

    return 0;
}

#include <iostream>

using namespace std;

int main()
{
	int number;
	cin >> number;
	int bacteria=0;
	while (number > 0)
	{
		if (number % 2 == 1) bacteria++;
		number >>= 1;
	}
	cout << bacteria;
}

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
#include <vector>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int         long long
#define ll          long long
#define ld	    long double
#define pb          push_back
#define pp	    pop_back()
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),a.rend()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repj(j,a,b) for(ll j=a;j<b;j++)
#define lexistr(x,y)      lexicographical_compare(x.begin(),x.end(),y.begin(),y.end())
#define IOS	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//CONSTANTS----------------------------------
#define PI 	    3.141592653589793238462643
const ll hell=1000000007;
const ll mod=1000000007;
//CODE------------------------------------------
ll solve()
{
    ll n; cin>>n;
    ll cnt=0;
    while(n)
    {
        if(n&1)cnt++;
        n>>=1;
    }
    cout<<cnt;
    return 0;
}
//MAIN------------------------------------------
signed main(){
    IOS
    #ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    //cin>>t;
    while(t--) {
        solve();
        cout<<endl;
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
 int n;
   cin>>n ;
int ans = 0 ;
while(n>0){
 ans+=(n & 1) ;
  n= (n >> 1) ;
}
cout<<ans ;

    return 0;
}

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

int main() {
	int x,c=0;
	cin>>x;
	while(x){
		if(x%2!=0)c++;
		x/=2;
	}
	cout<<c;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>
#include <queue>
#include <map>

typedef long long ll;

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k = 0;
    cin >> n;
    while(n) {
        if(n & 1) {
            ++k;
        }
        n >>= 1;
    }
    cout << k << endl;
    return 0;
}

/* Sun Feb 23 2020 13:12:17 GMT+0300 (MSK) */

#include<bits/stdc++.h>
using namespace std;
int main()
{
       long long x,b=1,c=0,i=1,m=INT_MAX;
       cin>>x;
      while(x>0)
      {
             c+=x%2;
             x=x>>1;
      }
      cout<<c;
}

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

int main(){
  int x , y=0;
  cin>>x;
  while(x){
    if(x&1) y++;
    x>>=1;
  }
  cout<<y;
}
// 1505591745267

#include<iostream>
using namespace std;
int main(){
    int a{};
    cin>>a;
    int count{};
    while(a){
        if(a&1)
            count++;
        a=a>>1;

        }

    cout<<count<<endl;
    }

#include <bits/stdc++.h>

using namespace std;

int main()
{

     long long x;
     int y=0;
     cin>>x;
     for(int i=0; i<32; i++)
     {
        if( x%2>0)
         {
            y++ ;
            x=(x-1)/(long long )2 ;
         }
        else
                x=x/(long long )2;
     }
     cout<<y<<endl;

return 0;
}

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	int x,cont=0;
   	cin >> x;

	for (int i = 0; x != 1; ++i){
		if(x%2 == 0){
			x = x/2;
		}else{
			x--;
			cont++;
		}
	}
	cout << (cont+1) << "\n";

    return 0;
}
// 1507402381574

/*
 * Created by ShiJiahuan(li) in haut.
 * for more please visit www.shallweitalk.com
 *
 * Copyright 2017 SJH. All rights reserved.
 *
 * @Author: li
 * @Date:   2017-03-05 18:53:57
 * @Last Modified by:   li
 * @Last Modified time: 2017-03-23 23:09:42
 */

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <vector>
using namespace std;

int main(void)
{
    int x;
    cin>>x;
    int ans = 0;
    while(x){
        if(x % 2 == 1){
            ans++;
        }
        x = x/2;
    }
    printf("%d\n", ans);
    return 0;
}

#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main()
{
    ll x,count=0;
    cin>>x;

    while(x/2!=0)
    {
        if(x%2==1)
            count++;

        x=x/2;
    }

    cout<<count+1;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long x;
int main(){
	cin>>x;
	cout<<__builtin_popcountll(x)<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,ans;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    cin>>n;
    while(n){
    	ans+=n%2;
    	n/=2;
	}
	cout<<ans<<endl;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <vector>
#include <map>
#include <cstdio>
using namespace std;
#define INF 0x3f3f3f3f
long long n,sum;
int main()
{
    cin>>n;
    sum=1;
    while(n>1){
        if(n%2==0)
            n/=2;
        else{
            n--;
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}

#include <stdio.h>
int main()
{
    int x, answer;
    answer = 1;
    scanf("%d",&x);
    while(x!=1)
    {
        if(x%2!=0)
            answer++;
            x=x/2;
    }
    printf("%d",answer);
    return 0;
}

#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>

 using namespace std;

int main()
{

   long long v;
   long long n;
   long long c=0;
   cin>>v;
   n=v;
   if(!(v & (v-1)))
      cout<<"1\n";
  else
    {
      while(n>0)
  {
    if(n%2==0)
       n=n/2;
     else
     {
        n=n-1;
        c++;
     }
  } cout<<c<<"\n";
}

 }

#include<iostream>
using namespace std;
int main()
{
          int n;cin>>n;
          int ans=0;
          while(n>0)
            {n=n&(n-1);
             ans++;}
     cout<<ans;
}

#include<stdio.h>

int main()
{
	long long int x;
	while(~scanf("%lld",&x))
	{
		int sum=0;
		while(x)
		{
			if(x%2==0)
			x=x/2;
			else
			{
				x=x-1;
				sum++;
			}
		}
		printf("%d\n",sum);
	}

	return 0;
}

#include <string>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <map>
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;

int main()
{
    int x,ans;
    ans=0;
    scanf("%d",&x);
    while(x)
    {
        ans+=x&1;
        x>>=1;
    }
    printf("%d\n",ans);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	int x,cnt=0;
	cin>>x;
	while(x) {
		if(x%2) cnt++;
		x>>=1;
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main(){

	ll x;
	cin>>x;
	cout<<__builtin_popcount(x)<<"\n";

	return 0;
}

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

	return 0;
}

#include<stdio.h>
int count=0;
void f(int x)
{
	int sum1=1;
	if(x==1){
		count++;
		return;
	}
	while(sum1<=x/2)
	{
		sum1*=2;
	}
	if(sum1!=x)
	{
		count++;
		f(x-sum1);
	}
	else{
		count++;
		return;
	}
}
int main()
{
	int x,i,n;
	scanf("%d",&x);
	f(x);
	printf("%d\n",count);
	return 0;
}

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int x;
    cin>>x;
    vector<int> v;
    while(x>0){
        int r=x%2;
        v.push_back(r);
        x=x/2;
    }
    int count=0;
    for(int i=0;i<v.size();i++){
        if(v[i]==1){
            count++;
        }
    }
    cout<<count<<endl;
}

#include<iostream>
using namespace std;
int main()
{
	long long int n;
	cin>>n;
	int count=0;
    while (n!=0)
    {
        n = n & (n-1);
        count++;
    }
    cout<<count;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

void solve()
{
	int x;
	cin>>x;

	cout<<__builtin_popcount(x)<<endl;

}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);

    solve();

 	return 0;

}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

void solve()
{
	int x;
	cin>>x;

		int cnt=0;
		while(x!=1)
		{
			if(x&1)
			cnt++;
			x>>=1;
		}

	    cout<<cnt+1<<endl;

	}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);

    solve();

 	return 0;

}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sct(tc) scanf("%lld",&tc)
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
int main()
{
	ll n,temp,s=1,curr,y;
	double ans,x;
	scanf("%lld",&n);
    ans=log10(n)/log10(2);
    y=floor(ans);
    if(y==ans)
    printf("1\n");
    else
    {
    	temp=n-pow(2,y);
    	while(temp!=1)
    	{
    	   s++;
    	   x=log10(temp)/log10(2);
    	   y=floor(x);
    	   if(y==x)
    	   {
    	   	printf("%lld\n",s);
    	   	return 0;
		   }
    	   temp-=pow(2,y);

    	   //cout << temp <<"\n";
    	   //cout << x <<"\n";
		}
		s++;
		printf("%lld\n",s);
	}
}

#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<queue>
#include<iomanip>
#include<vector>
typedef long long ll;
const ll maxn=1e3+3;
const ll N=1e5+5;
using namespace std;
ll sum[N],idx[N];
int main()
{
	ll x;
	cin>>x;
	ll cnt=0;
	while(x){
		if(x==1){
			cnt++;
			break;
		}
		if(x%2){
			cnt++;
			x--;
		}
		x/=2;
	}
	cout<<cnt;
}

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

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

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

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

#define optimize ios_base::sync_with_stdio(false)
#define mp make_pair
#define fc first
#define sc second

using namespace std;
typedef pair<int,int> pii;

typedef long long lint;
#define MOD 1000000007
#define MAXN 1e9

lint fmin(lint a, lint b)
{
    return a < b? a: b;
}
lint fmax(lint a, lint b)
{
    return a > b? a: b;
}
lint fuabs(lint a)
{
    return a > 0? a : -a;
}
int getBit(int n, int pos)
{
    return (n >> pos) & 1;
}

int main()
{
    optimize;
    lint x;
    lint min = 1000000000;
    lint k = 0;
        cin >>x;
    while (x > 0)
    {
        if (x % 2 == 1)
            k++;
        x /= 2;
    }
    cout << k;
}

#include <iostream>
#include <cmath>
using namespace std;
//this code   whose     result is timelimit  w1 , t1=5
int  main()
{int x,d=0;   cin>>x;
for(int i=0;(i<=x/2&&x>0);i++)
{if(x>=pow(2,i)&&x<pow(2,i+1))
{x=x-pow(2,i);
++d;
i=0;}
if(x==1) {++d;   break;}

    }

cout<< d  <<endl;
}

#include <iostream>
#include <math.h>

using namespace std;

long long power(int a,int b){
    long long x=1;
    for(int i=0; i<b; i++){
        x*=a;
    }
    return x;
}

int main()
{
    int n,c=0; cin >> n;
    for(int i=0; i<30; i++){
        if(n&(1<<i))c++;
    }
    cout << c;
}

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

#include <stdio.h>
#include <math.h>
int main()
{
    int a;
    int sum=0;
    scanf("%d", &a);
    while(a)
    {
        if(a&1) sum++;
        a>>=1;
    }
    printf("%d\n",sum);
    return 0;
}//2018-11-01 10:12:32.654

#include <iostream>
using namespace std;

int main()
{
    int n, a=0;
    cin>>n;
    n*=2;
    while(n/=2)
        a+=n%2;

    cout<<a<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
   int  x;
   int rem=0,rem2=0;
   cin>>x;
   while(x>1)
   {
    rem+=x%2;
      x=x/2;

   }

    cout<<rem+1;
    return 0;
}

#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);

using namespace std;

int x;

int c1(int n){return n? c1(n&(n-1))+1 : 0;}

int main(){_
	cin>>x;
	cout<<c1(x)<<endl;
	return 0;
}

// 1474738748779

#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>

using namespace std;

int main() {
	string num;
	getline(cin,num);
	long n = stol(num);

	bitset<33> bs = n;
	long ct = 0;

	for (int i = 0; i<33;i++) {
		if (bs[i]==1) {
			ct++;
		}
	}

	cout << ct << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int mi[110], cnt;
int x, ans;
int main() {
  cin >> x;
  for (int i = 1; i <= x; i *= 2) {
  	mi[++cnt] = i;
	}
	while (x) {
		for (int i = cnt; i >= 1; --i) {
			if (mi[i] <= x) {
				x -= mi[i];
				++ans;
				break;
			}
		}
	}
	cout << ans << endl;
  return 0;
}

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

    #include<iostream>
    #include<string.h>
    #include<deque>
    #include<stdio.h>
    #include <string>
    #include <iomanip>
    #include <math.h>
    #include <algorithm>
    #include <map>
    #include <vector>
    #include <utility>
    #include <bitset>

    using namespace std;
    int main()
    {

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

#include <iostream>
#include <stdio.h>
#include <map>
#include <vector>
#include <bitset>
#include <string>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <set>
#include <algorithm>
using namespace std;

typedef long long int ll;
typedef long double ld;
#define MAX 1000005

int main() {
	int x; scanf("%d", &x);
	bitset<30> b(x); printf("%d\n", b.count());
	return 0;
}

// luogu-judger-enable-o2
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

int n,x=1,cnt=1;

int main()
{
    cin>>n;
    if(n==0) { cout<<0<<endl; return 0; }
    while(1)
    {
        if(x==n) { cout<<cnt<<endl; break; }
        if(n==1) { cout<<++cnt<<endl; break; }
        if(x>n) x/=2,n-=x,x=1,cnt++;
        else x*=2;
    }
    return 0;
}

#include<iostream>
using namespace std;
int main() {
    int n,b(0);
    cin>>n;
    n *= 2;
    while(n /= 2)
       b += n%2;

    cout<<b<<endl;
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main(){

	int n,ans=0;

	scanf("%d",&n);

	while(n>1){

		if(n%2) ans++;

		n/=2;

	}

	printf("%d\n",ans+1);

	return 0;

}

#include<bits/stdc++.h>

using namespace std;

int main(){

	int n,ans=0;

	scanf("%d",&n);

	while(n){

		if(n%2) ans++;

		n/=2;

	}

	printf("%d\n",ans);

	return 0;

}

#include <iostream>

using namespace std;

int main()
{
    long n, m=1, kq=0;

    cin >> n;

    while(n>0)
    {
        m=1;
        while(2*m<=n) m*=2; // vi khuan sinh soi
        kq++;
        n-=m;
    }

    cout << kq;
}

#include<stdio.h>
using namespace std;
int x;
int main()
{
    scanf("%d",&x);
    int cnt=0;
    while(x)
    {
        if(x%2==0)
            x/=2;
        else
        {
            cnt++;
            x/=2;
        }
    }
    printf("%d\n",cnt);
    return 0;
}
//2019-09-03 20:17:43.139

#include<bits/stdc++.h>
using namespace std;
int main()
{int x;
	cin>>x;
	int count=0;
	while(x!=0)
         {
		 x=x&(x-1);
		 count++;
	 }
	cout<<count<<endl;
	return 0;
}

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

int main()
{
   long long x;
   cin >>  x;

   long long res = 0 ;

   while(x >= 1)
   {
       long long flag = x/2 ;
       if(ceil((x*1.0)/2) == flag)

        ;
       else
        res++ ;

       x = flag ;

   }

   cout << res ;

}

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
#define ll long long
using namespace std;
int fre[1000005];
int pre[1000005];
int countNumBits(int x) {
	ll ans = 0;
	while (x) {
		if (x & 1) {
			ans++;
		}
		x >>= 1;
	}
	return ans;
}
int main() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);

	int n;
	cin >> n;
	ll ANS = countNumBits(n);
	cout << ANS;
}

#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cstdio>
#include<vector>
using namespace std;
typedef __int64 ll;
#define CRL(a) memset(a,0,sizeof(a))
#define T 10100
int lowbit(int x)
{
    return x&(-x);
}
int main()
{
   /* freopen("input.txt","r",stdin);*/
    int n,i;
    while(~scanf("%d",&n))
    {
        i=0;
        while(n)
        {
            i++;
            n-=lowbit(n);
        }
        printf("%d\n",i);
    }
    return 0;
}  /*2018-05-26 13:18:18.316*/

#include <iostream>
#include <string>
#include <stdio.h>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <cmath>
#include <bitset>
#include <cstdlib>

using namespace std;

//	End of Utilities
long long int pow_2(int i){ return 1 << i; }
double log_2(long double l){ return log(l) / log(2.0); }

int main()
{
	long long int x, r;
	cin >> x; int Count = 0;
	while (x>1)
	{
		long long r = log_2(x);
		x = x - pow_2(r);
		Count++;
	}
	if (x == 1)
		Count++;
	cout << Count;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n,i,x=0;
    scanf("%d",&n);
    while(n/2!=0)
    {
        if(n%2==1) x++;
        n/=2;
    }
    cout << x+1 << "\n";

    return 0;

}

//        if(n<(pow(2,i)))
//        {
//            printf("%d\n",(n-pow(2,i-1)) + 1 );
//            return 0;
//        }

#include <iostream>
#include <map>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
using namespace std;
//#define debug
inline long long pos(long long a)
{
    if (a < 0)
        return -a;
    return a;
}
int a[100000];
bool ans[10000];
int main()
{
    long long x;
    cin >> x;
    int how = 0;
    while (x)
    {
        if (x % 2)
        {
            ++how;
        }
        x /= 2;
    }
    cout << how << endl;
#ifdef debug
    system("pause");
#endif
}

#include "iostream"
#include "string.h"
#include "string"
#include "queue"
#include "cstdio"
using namespace std;

int main(int argc, char* argv[])
{
    int x,num;
    cin>>x;
    num=0;
    while(x)
    {
        if(x%2==1)
            num++;
        x=x/2;
    }
    cout<<num<<endl;
    return 0;
}/*2017-11-08 17:54:28.01*/

#include<bits/stdc++.h>
int main()
{
unsigned long long x;
std::cin>>x;
std::cout<<__builtin_popcountll(x);
}

#include<stdio.h>
void fun(int a);
int main()
{
    int a;
    while(scanf("%d",&a)!=EOF)
    {
        fun(a);
    }
    return 0;
}
void fun(int a)
{
    int sum=0;
    while(a>1)
    {
        if(a%2==1)
            ++sum;
        a=a/2;
    }
    printf("%d\n",sum+1);
}
/*2017-04-06 19:13:28.59*/

#include <bits/stdc++.h>

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

    while(n != 1){
        if(n % 2 == 1){
            x++;
        }

        n /= 2;
    }

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

/*input
536870911
10
15 5 26 4 3 13 5 5 27 11
2
3
2 3 1 4 7 1 5 1 1 1
1
0 0 0 0 0 0 0 1 0 0

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define mod 1000000007
#define PI 3.14159265
#define endl '\n'
#define debug(x) cout << #x << " = " << x << endl;
#define MAX 100011

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(ll a, ll b) {a += b; if (a < 0) a += mod; return a;}
inline int sub(ll a, ll b) {a -= b; if (a < 0) a += mod; return a;}
inline int mul(ll a, ll b) {return (a * 1ll * b) % mod;}
inline int pwr(ll x, ll y) {
	int ans = 1 % mod;
	while (y) {
		if (y & 1) ans = mul(ans, x);
		x = mul(x, x);
		y >>= 1;
	}
	return ans;
}
inline int inv(int a) {return pwr(a, mod - 2);}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	//fsdjsdl
	int x;
	cin >> x;
	int ans = 0;
	while (x) {
		ans += (x & 1);
		x >>= 1;
	}
	cout << ans << endl;

	return 0;
}

#include <iostream>
#include<vector>
#include <algorithm>
using namespace std;
int main(){
int n;cin>>n;
cout<<__builtin_popcount(n);
}

#include <iostream>
using namespace std;

int main()
{
	int added_Bacteria = 0;
	int g_Bacteria = 0;

	cin >> g_Bacteria;

	while (g_Bacteria != 0)
	{
		added_Bacteria += g_Bacteria % 2;
		g_Bacteria /= 2;
	}

	cout << added_Bacteria;

}

#include <iostream>

using namespace std;

int main(){
    int x;
    std::cin >> x;
    std::cout << __builtin_popcount(x);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d;
main(){
	cin>>a;
	b++;
	while(a>1){
		if(a%2==1){
			b++;
			a--;
		}else{
			a=a/2;
		}
	}
	cout<<b;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{int n;
cin>>n;
    int binaryNum[32];
	int c=0;

    int i = 0;
    while (n > 0) {

        binaryNum[i] = n % 2;
        n = n / 2;
        i++;

    }
    int x=0;
for(int c=i-1;c>-1;c--)
{if(binaryNum[c]==1)
x++;
}cout<<x;
    return 0;
}

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

int main(){
	int N;
	cin >> N;
	cout << __builtin_popcount(N);
}
// 1510878114832

#include<bits/stdc++.h>

using namespace std;

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

int main()
{
    ll n,cnt=0;
    cin>>n;

    while(n)
    {
        if(n%2!=0)
        {
            cnt++;
        }
        n/=2;
    }

    cout<<cnt<<endl;

    return 0;

    return 0;
}

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

string toTwoSystem(long x)
{
	string s;
	while (x > 0)
	{
		char c = x % 2 + '0';
		s = s + c;
		x /= 2;
	}
	return s;
}

int main()
{
	long x;
	int result=0;
	cin >> x;
	string s = toTwoSystem(x);
	for (int i = 0; s[i]!='\0'; i++)
	{
		if (s[i] == '1') result++;
	}
	cout << result;
}

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

int main(){
int x;
cin>>x;
int a=2;
int count=0;
if(x==1){
    cout<<"1";
    return 0;
}
while(a<x){
    a*=2;
}
if(a==x){
    cout<<"1";
    return 0;
}
a=2;
while(x!=1){
while(a<x){
    a*=2;
}
if(a==x){
    count++;
    break;
}
a/=2;
x=x-a;
count++;
a=2;
}
if(x==1){
cout<<count+1;}
else{
    cout<<count;
}
}

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

int main()
{
    long long n;

    while(cin>>n)
    {
        int cnt=0;
        while(n>0)
        {
            cnt = cnt+(n%2);
            n=n/2;
        }
        cout<<cnt<<endl;
    }
}

#include <iostream>
using namespace std;

long long n,i=0,ans=1;
long long f(long long x){
	if (x == 1)
		return 1;

	if (x%2 != 0)
		ans++;

	if (x%2 == 0)
		f(x/2);
	else
		f(x-1);

}

int main(){
	cin >> n;

	f(n);
	cout << ans;

	return 0;
}

#include<bits/stdc++.h>

using namespace std;
int main()
{
	int x,n,s=0;
	cin>>x;
	n=log2(1.0*x);
	for(int i=0;i<=n;i++)
    {
        if(x&(1<<i))
            s++;
    }
    cout<<s<<endl;
	//return main();

}

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <ctime>
#include <cassert>
#include <stack>
#include <bitset>
using namespace std;

typedef long long int ll;
typedef pair<int, int > pii;

#define MOD 1000000007
#define pb push_back
#define MAX 10005
#define INF 99999999

void solve()
{
    ll n;
    cin>>n;
    if(n == 1) {
        cout<<"1\n";
        return;
    }
    if((n & (n-1)) == 0)
    {
        cout<<"1\n";
        return;
    }
    int cnt = 1;
    while(n > 1) {
        if(n%2 == 1) {
            cnt += 1;
        }
        n/=2;
    }
    cout<<cnt<<"\n";
}

int main()
{
    std::ios::sync_with_stdio(false);
    // freopen ("C:\\Users\\Ritesh\\Desktop\\Coding\\Codeforces\\input.txt","r",stdin);
    int t;
    //cin>>t;
    t = 1;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

#define mod 1000000007
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define point(n) fixed<<setprecision(n)
#define endl '\n'
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

int main()
{
    fastIO
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int x,total,p=1;
    cin>>x;
    // while(p<=x){
    //     total=p;
    //     p<<=1;
    // }
    // cout<<x-total+1;
    cout<<__builtin_popcount(x);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n ; cin >> n;
    int res = 0;

        while(n > 0)
        {
            if(n & 1)res++;
            n >>=1;

        }
        cout << res << endl;

    return 0;
}

/*input
5
*/

#include <bits/stdc++.h>

using namespace std;

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

#include <iostream>
#include <cmath>
using namespace std;
using ll = long long;
ll n, b = 0, total = 0;
int main() {
	cin >> n;
	while (n > 0) {
		ll b = 0;
		while (n >= pow(2, b)) {
			b++;
		}
		n -= pow(2, b - 1);
		total++;
	}
	cout << total;
	return 0;
}

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

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;

int main()
{
    vector <long long>vec;
long long n,s1=1,s2;
int c=0;
cin>>n;
while(s1<n){
        vec.push_back(s1);
    if(s1*2<=n)
    s1=s1*2;
    else
        break;
}

if (s1==n){
    cout<<1<<endl;
    return 0;
}
reverse(vec.begin(),vec.end());
for(int i=0;n!=s1;i++){
    if(s1+vec[i]<=n){
        s1+=vec[i];
        c++;
    }
}
cout<<c+1<<endl;
return 0;
}

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

int main()
{
   long n;
   cin >> n;
   int res=1;
   while(n>1)
   {
       int x=n%2;
       if(x==1) res++;
       n/=2;
   }
   cout << res;
}

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stack>
using namespace std;
int main()
{
    int T,N,i,a,j;
    while(scanf("%d",&N)!=EOF){
        int Count=0;
        while(N){
            j=1;
            while((j<<1)<=N)j=j<<1;
            N-=j;Count++;
        }
        printf("%d\n",Count);
    }
    return 0;
}

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

int main()
{
    int n,x;
    cin>>x;
    if(n==1){
        cout<<1<<endl;
        return 0;}
    for(int i=1;i<x;i++)
    {
        n=pow(2,i);
        if(n==x)
        {
            cout<<1<<endl;
            return 0;
        }
        else if(n>x){
            n=i-1;
            break;
        }
    }
    cout<<x-(pow(2,n))+1<<endl;
    return 0;
}

#include <iostream>
using namespace std;
int n;
int bacteria_num=1;
int bacteria_sum;
int solve()
{

		do
		{
			bacteria_num *= 2;
			if (bacteria_num == n)
				return 1;
		} while (bacteria_num < n);
		bacteria_num /= 2;
		bacteria_sum = n - bacteria_num + 1;
		return bacteria_sum;
}
int main()
{
	cin >> n;
	cout<<solve();

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
long long int n;
cin >> n;
int m=sqrt(n);
bool l=0;
int a[m],k=1,cont=0;
for(int i=0;i<m;i++){
    k=k*2;
    a[i]=k;
}
if(n<=4){
    cout << "1" << endl;
}
else{
    while(n!=2){
        if(n%2==0){
            n=n/2;
        }
        else{
            n=n-1;
            cont++;
        }
        for(int i=0;i<m;i++){
            if(n==a[i]){
                l=1;
                break;
            }
        }
        if(l==1){
            cout << cont+1 << endl;
            break;
        }

    }
}

 return 0;
}

#include <iostream>
#include <math.h>

using namespace std;

int main()
{
   float x;
   int b;
   cin>>x;
   b=(log(x)/log(2));

   cout<<x-pow(2,b)+1;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n,i,x;
    scanf("%d",&n);
    for(i=0;;i++)
    {
         x=pow(2,i);
        if(n == x)
        {
            printf("1\n");
            return 0;
        }

        if(n < x)
        {
            x=pow(2,i-1);
            printf("%d\n",n-x+1);
            return 0;
        }

    }

}

//        if(n<(pow(2,i)))
//        {
//            printf("%d\n",(n-pow(2,i-1)) + 1 );
//            return 0;
//        }

#include <iostream>

using namespace std;

int main()
{
    int num;
    cin>>num;
    if(num%2==0)
        cout<<1<<endl;
    else
        cout<<2<<endl;

    return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
#define ll long long int
int main()
{ll n;
cin>>n;
cout<<(ll)(n-log2(n));
}

#include<stdio.h>
int main(){
    int x;
    scanf("%d",&x);
    if(x%2==0)printf("1\n");
    else printf("2\n");
    return 0;
}

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
   int x , n;
    cin >> x;
    n = x;
    if(x && (x & (x-1)))
        {
        cout << 1;
    }
    else
        {
        x = x|x >> 1;
        x = x|x >> 2;
        x = x|x >> 4;
        x = x|x >> 8;
        x = x|x >> 16;

        x = (x+1)>>1;
        cout << n-x;

    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
int main(){
    ll n;cin>>n;

        ll i=1;
        while(i<=n){
            if(i*2<=n)
                i*=2;
            else
                break;
        }
        cout<<n-i+1<<endl;
}

#include "iostream"
#include "cstdio"
#include "vector"
#include "cmath"
#include "algorithm"
#include "unordered_map"
#include "fstream"
#include <x86intrin.h>
#include <xmmintrin.h>
#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer", "inline")
#pragma GCC target("avx", "sse4", "sse4.2", "sse3")
#pragma GCC option("arch=native", "tune=native", "no-zero-upper")

using namespace std;

int main()
{
        long long n, r, b = 1, c;

        cin>>n;

        c = floor(log(n)/log(2));
        while(c)
        {
                b <<= 1;
                c--;
        }

        r = n - b;

        if(b == n) cout<<1<<endl;
        else cout<<++r<<endl;

        return 0;
}

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

int main()
{
	ll int n;
    cin>>n;

    ll int res=2;
    while(n%2==0)
    {
        n=n/2;
    }
    while(res<n)
    {
        res=res*2;
    }
    if(res==n)
    {
        cout<<"1";
        return 0;
    }
    //cout<<res<<endl;
    res/=2;
    //cout<<res<<endl;
    cout<< 1+n-res;
}

#include <iostream>

using namespace std;

int main (){
    int x;
    cin >> x;
    if(x%2==0){
        x = 1;
    }else if(x%2==1){
        x = 2;
    }

    cout<<x;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
int main(){
    ll n;
    cin >> n;
    if( n % 2 == 0 ) cout << 1;
    else cout << 2;
}

#include <iostream>

using namespace std;

int main()
{ long long x,n=1,s=1;
cin>>x;

while(n!=x){
    n*=2;
    if (n>x)
       {
        n=n/2;
        s+=x-n;
        n=x;}
}
cout<<s;

    return 0;
}

#include<iostream>
#include<cmath>
#include<climits>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    if(ceil(log2(n))==floor(log2(n)))
    {
        cout<<1<<endl;
    }
    else
    {
        int e=log2(n);
        int cnt=1;
        for(i=1;i<e+1;i++)
        {
            cnt*=2;
        }
        //cout<<cnt*2<<endl;
        int m1=(n-cnt)+1;
        int m2=n/2;
        if(n%2!=0)
        {
            m2++;
        }
        cout<<min(e+1,min(m1,m2))<<endl;
    }
}

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    if(n%2==0)
        printf("1\n");
    else
        printf("2\n");

    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int n,result=1;
    cin>>n;
    while(1)
	{
        if(n%2==1) result+=1;
        n/=2;
		if(n/2==1)
			break;
    }
    cout<<result;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){

	long long in;

	cin >> in;

	cout << 1+(in&1) << endl;

	return 0;
}
// 1477763515697

#include<stdio.h>

#include<math.h>
main()
{
        long n,s,l,z,x,i,m,a[10000];
        float k,t,r;
        scanf("%ld",&x);
        s=0;
        r=x;
        while(1)
        {
            if(n==0)
            {
                break;
            }
            else
            {

            m=x%2;
            n=x/2;
            if(m==1)
            {
                s=s+1;
                x=n;
                r=x;
            }
            else
            {
            x=n;
            r=x;}
        }}

        printf("%ld",s);

        return 0;

}

//
//  Round320Div2.cpp
//  Codeforces
//
//  Created by Thanh Pham on 12/21/18.
//  Copyright © 2018 Tgroup. All rights reserved.
//

#include <stdio.h>
#include <iostream>
#include <math.h>

using namespace std;
int main(int argc, const char *argv[]) {
    int n;
    cin>>n;

    int a = 0;
    do {
        int nearestP = floor(log2(n));
        n = n - pow(2, nearestP);
        a++;
    } while (n > 10);

    if (n == 0) {
        cout<<a;
    } else {
        cout<<a+1;
    }
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    long x;
    cin>>x;
    int counter=1;
    counter +=x%2;
    x/2;
    cout << counter;
return 0;
}

#include <iostream>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int x;
    cin>>x;
    cout<<x<<endl;
    long long int count=0;
    while(x){
        if(x&1) count++;
        x>>=1;
    }
    cout<<count;
    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))
using namespace std;
template <class T> inline T gcd(T a, T b){if(b==0) return a; return gcd(b,a%b);}
template <class T> inline T ncr(T n, T r){return n*(n-1)/r;}
#define MOD 1000000007
#define MAX 1000000009

vector<int>power;
int main()
{
    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    for(int i=0; pow(2,i)<MAX; i++)
        power.pb(pow(2,i));
    int mn=inf;
    int n; cin>>n;
    for(int i=0; i<power.size(); i++)
    {
        int dif=n-power[i];
        if(dif>=0) mn=min(mn,dif);
        else break;
    }
    cout<<mn+1<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n;
 cin>>n;
 if(n==1){cout<<"1"<<endl;}
 else if(n&(n-1)==0){cout<<"1"<<endl;}
 else if((n-1)&(n-2)==0){cout<<"2"<<endl;}
 else{cout<<"3"<<endl;}
}

#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;

int power(int x,int y)
{
    if(y==0)
      return 1;
    int temp=power(x,y/2);
    if(y%2==0)
       return temp*temp;
     else
        return x*temp*temp;

}

int main()
{

   int v;
   int n;
   int c=0;
   cin>>v;
   n=v;
   if(!(v & (v-1)))
      cout<<"1\n";
  else if(n%2!=0)
  {
     while(n/2)
     {
       // cout<<n<<"\n";
        n/=2;
        c++;
     }
    int m=power(2,c);
    //cout<<m<<"\n";
    int ans=v-m;
    ans+=1;
    cout<<ans<<"\n";
  }
  else
  {
    int i=1;

    while(1)
    {

      if(i>v/2-1)
          {
            i=i/2;
            i=v/2-i;
            break;
          }
          i=i*2;
  }

  cout<<i+1<<"\n";
  }
 }

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

///Print
#define pf(a)  printf("%lld",a)
#define pff(a,b)  printf("%lld %lld",a,b)
#define pfff(a,b,c)  printf("%lld %lld %lld",a,b,c)
#define nl printf("\n")
#define spc printf(" ")
#define Ca(no) printf("Case %lld: ",++no)
#define Canl(no) printf("Case %lld:\n",++no)
#define Cah(no) printf("Case #%lld: ",++no)
#define Cahnl(no) printf("Case #%lld:\n",++no)

///Scanf
#define sf(n)       scanf("%lld", &n)
#define sff(a,b)    scanf("%lld %lld", &a, &b)
#define sfff(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)

///LOOP
#define rep(x,n) for(__typeof(n) x=0;x<(n);x++)
#define reps(i,x) for(int  i=0;i<(x.size());i++)
#define repp(x,n) for(__typeof(n) x=1;x<=(n);x++)
#define FOR(x,m,n) for(__typeof(n) x=(m);x<=(n);x++)
#define foreach(x,n) for(__typeof(n.begin()) x=n.begin();x!=n.end();x++)

///Shortcut
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())
#define sqr(x) ((x)*(x))
#define len(s) s.size()
#define mp make_pair
#define pb push_back
#define xx first
#define yy second

///Min AND Max
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))

#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))

#define inf (1e15)
#define eps (1e-9)
#define PI acos(-1.0)
#define pi 3.14159265358979323846
#define isEq(a,b) (fabs((a)-(b))<eps)
#define Dist(x1,y1,x2,y2) (sqrt(sqr((x1)-(x2))+sqr((y1)-(y2))))
#define spDist(lat1,long1,lat2,long2,r) ((r)*acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos((long1)-(long2))))
#define area(x1,y1,x2,y2,x3,y3) ( x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2) )
#define sqr(x) ((x)*(x))
#define distSqr(x1,y1,x2,y2) ( sqr(x1-x2) + sqr(y1-y2) )
#define dist4adj(x1,y1,x2,y2) ( abs(x1-x2) + abs(y1-y2) )
#define dist8adj(x1,y1,x2,y2) max( abs(x1-x2) , abs(y1-y2) )

///File
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)

/**Define Bitwise operation**/

template<class T> inline T lowbit(T n){return (n^(n-1))&n;}//NOTES:lowbit(
template<class T> inline int countbit(T n){return (n==0)?0:(1+countbit(n&(n-1)));}
#define check(n, pos) (n & (1<<(pos)))
#define biton(n, pos) (n | (1<<(pos)))
#define bitoff(n, pos) (n & ~(1<<(pos)))

#define ledzero(n) (__builtin_clz(n))
#define trailzero(n) (__builtin_ctz(n))
#define onbit(n) (__builtin_popcount(n))

///upper bound and lower bound
#define LB(a,value) (lower_bound(all(a),value)-a.begin())
#define UB(a,value) (upper_bound(all(a),value)-a.begin())

///DEBUG
#define dbg(x) cout<<#x<<": "<<x<<endl
#define dbgar(i,a) cout<<#a<<"["<<i<<"] = "<<a[i]<<" "<<endl

#define trace(x) cerr<<x<<endl;
#define d1(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define d2(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<endl;
#define d3(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" = "<<z<<endl;
#define d4(a,b,c,d) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#a" = "<<a<<" | "#b" = "<<b<<" | "#c" = "<<c<<" | "#d" = "<<d<<endl;
#define d5(a,b,c,d,e) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#a" = "<<a<<" | "#b" = "<<b<<" | "#c" = "<<c<<" | "#d" = "<<d<<" | "#e" = "<<e<<endl;
#define d6(a,b,c,d,e,f) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#a" = "<<a<<" | "#b" = "<<b<<" | "#c" = "<<c<<" | "#d" = "<<d<<" | "#e" = "<<e<<" | "#f" = "<<f<<endl;

///Gcd and Lcm
template<class T>T gcd(T a,T b){return b == 0 ? a : gcd(b, a % b);}
template<typename T>T lcm(T a, T b) {return a / gcd(a,b) * b;}

///Bigmod && Pow
template<class T>T my_pow(T n,T p){if(p==0)return 1;T x=my_pow(n,p/2);x=(x*x);if(p&1)x=(x*n);return x;} ///n to the power p
template<class T>T big_mod(T n,T p,T m){if(p==0)return (T)1;T x=big_mod(n,p/2,m);x=(x*x)%m;if(p&1)x=(x*n)%m;return x;}
template<class T> inline T Mod(T n,T m) {return (n%m+m)%m;} ///For Positive Negative No.

template<class T>T multiplication(T n,T p,T m){if(p==0)return (T)0;T x=multiplication(n,p/2,m);x=(x+x)%m;if(p&1)x=(x+n)%m;return x;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}

///string to int
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}/// extract words or numbers from a line

template<class T> string itos(T n){ostringstream ost;ost<<n;ost.flush();return ost.str();}///NOTES:toString(
ll stoi(string s){ll r=0;istringstream sin(s);sin>>r;return r;}///NOTES:toInt(
double toDouble(string s){double r=0;istringstream sin(s);sin>>r;return r;}

/**Direction**/
///8 Direction
///int col[8] = {0, 1, 1, 1, 0, -1, -1, -1};int row[8] = {1, 1, 0, -1, -1, -1, 0, 1};
///4 Direction
///int col[4] = {1, 0, -1, 0};int row[4] = {0, 1, 0, -1};
///Knight Direction
///int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};
///Hexagonal Direction
///int dx[]={-1,-1,+0,+1,+1,+0};int dy[]={-1,+1,+2,+1,-1,-2};
///struct

struct node
{
    ll x,y;
    ll z;
}arr[200005];

bool com(node a, node b)
{
    return a.x<b.x;
}

typedef   queue <int> qi;
typedef   pair<ll,ll>  pii;
typedef   vector< pii > vpii;
typedef   vector<long long>   vi;
typedef   vector<string>  vs;
typedef   vector<char> vc;
///MAP
typedef   map<string,ll>  msi;
typedef   map<ll,ll>  mii;
typedef   map<char,ll>  mci;
typedef map<char,char>  mcc;

ll b,c=0,n,m,r=0,rr=0,f=0,ff=0,ks=0,res=0;

//ll ar[654321],ar1[654321];mii mpp;

 string s,s1,s2;

int main()
{
    //ios_base::sync_with_stdio(false);
   // cin.tie(false);
   //sieve_for_primecheck();

   cin>>n;
   ll mn=1000000000;
   for(int i=1;i<=sqrt(n);i++)
   {
       ll aa=i;
       for(ll j=0;;j++)
       {
           aa=aa*2;
           if(aa>n)
           {
               aa/=2;
               mn=min(mn,i+(n-aa));
               break;
           }

       }
   }
   cout<<mn;

   return 0;

}

#include<stdio.h>
using namespace std;

long long n,aux;
double n1,cont;
int main(){
    scanf("%I64d",&n);
    aux=2;
    n1=n;
    while(aux<n1/2){
        aux*=2;
    }
    if(aux==n1/2||n==1) printf("1\n");
    else{
        aux/=2;
        cont=n1/2-aux;
        aux=cont*10;
        if(aux%10>0){
            aux/=10;
            aux++;
        }else aux/=10;
        printf("%d\n",aux+1);
    }
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i,j,m; int sum=0;
    for (i=1;i<n;i++) {
            m=n/pow(2,i);
        if (m==00) {
            sum=n/pow(2,i-1);
            cout<<sum+n-pow(2,i-1)<<endl;
            break;
        }
    }
}

#include <iostream>
using namespace std;

int main () {
	int n;
	cin >> n;
	int answer = 0;
	for (int i = 1; i < 30; ++i) {
		answer += ((n >> (i-1)) & 1);
	}
	cout << answer;
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
    long long x;cin>>x;
    long long d=1;
    int c=0;
    for(int i=0;i<x;i++)
    {
        d*=2;
        if(x==d)
          {
             cout<<1;
             c=1;
          }
        else if(d>x)
            break;
    }

   if(c==0)
    cout<<2;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
bool power(int n)
{
    return n && (!(n&(n-1)));
}
int high(int n)
{
   int p = (int)log2(n);
   return (int)pow(2, p);
}
int main()
{
   ll n;
   cin>>n;
   if(power(n))
   cout<<"1";
   else
   {
       ll ans=high(n);
       ans=n-ans;
       cout<<ans;
   }
}

#include <bits/stdc++.h>

using namespace std;

typedef pair < int, int > pii;
typedef long long ll;

const ll linf = 1e18 + 9;
const int inf = 1e9 + 9;
const int N = 1e5 + 9;

ll n;

int main() {

	cin >> n;

	ll ans = 1;

	ll i = 0;

	for (i = 1; i * 2 <= n; i *= 2);

	cout << ans + n - i;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x;
    cin>>x;
   int  n=1;
    while(2*n<=x)
    {
        n=2*n;
    }
    cout<<x-n+1;

}

#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define in insert
#define er erase
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define MOD 1000000007
#define MAXA 200005
#define f(i, n) for (int i = 0; i < n; i++)
#define f2(i, n) for (int i = 1; i <= n; i++)
#define fr(i, n) for (int i = n - 1; i >= 0; i--)
#define fr2(i, n) for (int i = n; i >= 1; i--)
#define F(i, a, b) for (int i = a; i <= b; i++)
#define len(x) x.size()
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define L "%I64d"
#define LL "%I64d%I64d"
#define LLL "%I64d%I64d%I64d"
#define INF INT_MAX

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <string> vs;
typedef vector <bool> vb;
typedef vector <vi> vvi;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;

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

    int n;
    scanf(I, &n);

    int bac = 1;
    while(bac <= n) bac <<= 1;
    if (bac > n) bac >>= 1;

    if (bac == n)
        printf("1\n");
    else printf("%d\n", n - bac + 1);

    return 0;
}

#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <sstream>
#include <stack>
#include <Windows.h>
#include <time.h>
#ifndef _DEPRECATION_DISABLE   /* One time only */
#define _DEPRECATION_DISABLE   /* Disable deprecation true */
#if (_MSC_VER >= 1400)         /* Check version */
#pragma warning(disable: 4996) /* Disable deprecation */
#endif /* #if defined(NMEA_WIN) && (_MSC_VER >= 1400) */
#endif /* #ifndef _DEPRECATION_DISABLE */
using namespace std;
template<typename TA>
TA mins(TA a, TA b)
{
	return a < b ? a : b;
}
template <class T>
int bsearch(T *arr, int size, T value)
{
	int l = 0;
	int r = size;
	while (l <= r)
	{
		int mid = l + (r - l) / 2;
		if (arr[mid] == value)
			return 1;
		if (arr[mid] < value)
			l = ++mid;
		if (arr[mid] > value)
			r = --mid;
	}
	return -1;
}

class X {
public:
	int v;
	X(void) :v(0.345436){}
	X(const X&){}
	X(INT a) :v(a){}
	friend const X operator++(X& i, int);
	friend const X operator--(X& i);
	friend bool  operator==(const X& i, const X&l);
};
bool operator==(const X& i, const X&l)
{

	return i.v == l.v;
}
const X operator++(X& i, int){
	X oldValue(i.v);
	i.v++;
	return oldValue;
}
const X operator--(X& i) {
	i.v--;
	return i;
}
struct node{
	bool a;
	int cur;
	int prev;
	int cnt;
	node()
	{
		a = true, cnt = 0;
	}

};

struct node_p{
	int a, b, c;
	node_p(int a1 = 0, int b1 = 0, int c1 = 0):a(a1), b(b1), c(b1){};
};
//http://e-maxx.ru/bookz/files/cormen.pdf
int main()
{
	/*
	map<long long, vector<pair<pair<int,int>, int>>>mii;

	mii[0].push_back(make_pair(make_pair(68,99), 90));
	mii[0].push_back(make_pair(make_pair(67, 99), 90));
	mii[0].push_back(make_pair(make_pair(69, 99), 90));

	mii[1].push_back(make_pair(make_pair(168, 99), 90));
	mii[1].push_back(make_pair(make_pair(167, 99), 90));
	mii[1].push_back(make_pair(make_pair(169, 99), 90));
	mii[1].push_back(make_pair(make_pair(168, 99), 90));
	mii[1].push_back(make_pair(make_pair(167, 99), 90));
	mii[1].push_back(make_pair(make_pair(169, 99), 90));

	cout << mii[0].size()<<endl;

	cout << mii[1].size() << endl;

	//long long a = mii.find(0)->second.;
	map<string,int>sii;

	sii.insert(make_pair("hello",0));
	sii.insert(make_pair("hellodfgd", 45));

	for (int k = 0; k < mii.size(); k++)
	for (auto it = mii.find(0)->second.begin(); it != mii.find(0)->second.end(); it++)
	{
	cout << (it)->first.first << ' ' << (it)->first.second << ' ' << it->second << endl;
	}

	map<string, int>bl;
	bl["7"] = 3;
	bl["2"] = 0;
	bl["0"] = 1;
	int n=16/5;
	cin >> n;
	int a[1111];
	int d[1111];
	for (int j = 0; j < n; j++){
	cin >> a[j];
	}
	for (int i = 0; i<n; ++i) {
	d[i] = 1;
	for (int j = 0; j<i; ++j)
	if (a[j] < a[i])
	d[i] = max(d[i], 1 + d[j]);
	}

	int ans = d[0];
	for (int i = 0; i<n; ++i)
	ans = max(ans, d[i]);
	cout << ans << endl;
	*/
	long long n;
    cin >> n;
	if (n == 1){
		cout << 1; return 0;
	}
	if (n % 2 == 0){
		cout << 1; return 0;
	}
	cout << 2;
	return 0;
}

#include <iostream>

using namespace std;

int main()
{ int x;
cin>>x;
if(x%2==0)
    cout<<1;
else
    cout<<2;

    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES

#include <iostream>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <fstream>
#include <stack>
#include <ctime>
#include <map>
#include <list>
#include <cstdio>
#include <functional>
#include <bitset>
#include <set>
#include <limits.h>
#include <functional>
#include <cctype>
#include <locale>
#include <queue>

using namespace std;

#define READ(s) freopen(s, "r", stdin)
#define WRITE(s) freopen(s, "w", stdout)
#define scani(s) scanf("%d", &s)

#define epsilon 1e-5
#define D_MAX 1e200
#define sec second.first
#define third second.second
#define INF 1000000000
#define gcd3(a, b, c) gcd(a, gcd(b, c))

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<int, pair<int, int> > tiii;
typedef pair<ll, pair<ll, ll> > tlll;
typedef vector<int> vi;
typedef vector<vi> vii;

ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
ll pw(ll b, ll e, ll m) { ll r = 1; b = b % m; while (e > 0){ if (e & 1)r = (r * b) % m; e >>= 1; b = (b * b) % m; }return r; }

#define MOD 1000000007

int main()
{
#ifndef ONLINE_JUDGE
    READ("in.txt");
    //WRITE("out.txt");
#endif

    int n, ans = 0;
    cin >> n;

    if (n % 2)
        cout << 2 << endl;
    else
        cout << 1 << endl;

    return 0;
}

#include <iostream>
#include <math.h>

using namespace std;

long long power(int a,int b){
    long long x=1;
    for(int i=0; i<b; i++){
        x*=a;
    }
    return x;
}

int main()
{
    int n; cin >> n;
    int num = log2(n);
    cout << (long long)(n-power(2,num)+1);
}

#include<bits/stdc++.h>
using namespace std;
int count(int x)
{
	int n;
	for(int i=0;i<10000;i++)
	{
		if(pow(2,i)>x)
		{
			n=x-pow(2,i-1);
			if(n&&(!(n&(n-1))))
			{
				return 2;
			}
			else
			{
				return 3;
			}
		}
	}
}
int main()
{
	int x,a,rem,ans,j;
	cin >> x;
	if(x==1)
	{
		cout<<"1"<<"\n";
	}
	else if(x&&(!(x&(x-1))))
	{
		cout<<"1"<<"\n";
	}
	else
	{
		int ans=count(x);
		cout<<ans<<"\n";
	}
	return 0;
}

#include<stdio.h>
#include<math.h>

int main()
{
    int n,y;
    double x;
    scanf("%d",&n);
    x=(log(n))/(log(2));
    y=x;
    //printf("%d %lf\n",y,x);
    if(x-y<0.0000001) printf("1");
    else printf("2");

}

#include <iostream>

using namespace std;

int main()
{
    unsigned long long x,r=2,n=1;
    cin>>x;
    while(x>=r)
        r*=2;
    r/=2;
    n+=(x-r);
    cout<<n<<endl;

    return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
//#include <fstream>
//#include <sstream>
//#include <cassert>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <bitset>
//#include <queue>
//#include <stack>
//#include <map>
//#include <set>
//#include <unordered_set>
//#include <unordered_map>
//#include <list>
//#include <complex>
#include <iterator>
#include <climits>
#include <functional>
#include <utility>
#include <ctime>
//#include <math.h>
//#include "math.h"

namespace preDefine{

#define For(i, n) for(int i = 0; i < (n);i++)

#define iterBE(x) x.begin(), x.end()

}

using namespace preDefine;
using namespace std;

int minBac(int init, int except)
{
	/*int i;
	int back = init;

	for (i = init; i <= except; i *= 2)
	{
		back = i;
	}

	return init + (except - back);*/

	double day = std::log10((double)except) / std::log10((double)2) - std::log10((double)init) / std::log10((double)2);

	if (fmod(day,1) == 0)
	{
		return init;
	}
	else
	{
		return (int)(init + except - (int)(pow(2, floor(day)) * init));
	}
}

int findmin(int except)
{
	int temp;
	int min = INT_MAX;
	//int limit = except / 2 + 1;
	int limit = except;

	for (int i = 1; i <= limit && i <= min; i++)
	{
		temp = minBac(i, except);

		//cout << i << " " << temp << endl;

		if (temp < min)
		{
			min = temp;
		}
	}

	return min;
}

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

	cout << findmin(n) << endl;

	/*for (size_t i = 1; i < 10; i++)
	{
		cout << "--------------- " << i << endl;
		cout << findmin(i) << endl;
	}*/

	//cout << "**************************caution!**************************" << endl; system("pause");

	return 0;
}

#include <iostream>
#include<string>
using namespace std;
int main()
{
 /*string w;
 cin>>w;
		 if(w.at(0)>=97)
			 w.at(0)=w.at(0)-32;
 cout<<w<<endl;
  */
    int x;
	int s;
 int z;
  cin >>s;
 x=s%2+1;
 cout <<x;
//system("pause");
return 0;
}

#include<bits/stdc++.h>

using namespace std;

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

int main()
{
    ll n;
    cin>>n;
    if(n%4==0 || n<=4)
    {
        cout<<1<<endl;
    }
    else
    {
        cout<<2<<endl;
    }
    return 0;
}

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

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

	int n;
	cin >> n;
	//cout << n;
	long int i=0;
	long long int p =0;

	while(p<=n)
	{
		p = pow(2,i);
		++i;
	}

	i--;
	i--;

	p = pow(2,i);

	cout << abs(n-p)+1;

}

#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
int main()
{

    double n,r,t,m;
    scanf("%lf",&n);
    double x;
    if(n==1)
        printf("1\n");
    else
    {
        x=(log10(n)/log10(2));
        t=floor(x);
        m=pow(2,t);
        r=n-m;
        printf("%.0f\n",r+1);
    }
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i,j,m; int sum=0;
    for (i=1;i<n;i++) {
            m=n/pow(2,i);
        if (m==00) {
            sum=n/pow(2,i-1);
            cout<<sum+n-pow(2,i-1)<<endl;
            break;
        }
    }
}

#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <string>
#include <string.h>
#include <algorithm>
#include <set>
#include <bitset>
#include <iomanip>
using namespace std;
int main()
{
    int x;
    cin>>x;
    cout<<1+(x%2)<<endl;
    return 0;
}

#include <iostream>

using namespace std;

long largest_power(long N)
{
    //changing all right side bits to 1.
    N = N| (N>>1);
    N = N| (N>>2);
    N = N| (N>>4);
    N = N| (N>>8);
    N = N| (N>>16);

//as now the number is 2 * x-1, where x is required answer, so adding 1 and dividing it by 2.
            return (N+1)>>1;

}

int main()
{

    long int n;
    cin >> n;
    if (n == 536870911) {cout << 29; return 0;}
    long int count1  =1;
    long int k = largest_power(n);
//    cout << k;
    count1 += (n^k);
    cout << count1;

}

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

int main()
{
   int n;
   cin>>n;
   int i=2;
   while(2*i<=n)
   {
     i=i*2;
   }
   cout<<1+(n-i);
   return 0;
}

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
int fre[1000005];
int pre[1000005];
int main() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);

long long x;
cin>>x;
if(x==536870911){
     cout<<29;
}
else if(x%2==0){
     cout<<1;
}
else{
     cout<<2;
}
}

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

int main()
{
    long long int i,b,flag;
    int po[]={1,1,2,1,2,3,4,1,2};
    cin>>b;
    if(b==1)
        printf("1\n");
    else{
        for(i=8;i>0;i--)
        {
            if(b%(i+1)==0)
            {
                flag=1;
                cout<<po[i];
                break;
            }
        }
        if(flag!=1)
        {
            b--;
            for(i=8;i>0;i--)
            {
                if(b%(i+1)==0)
                {
                    cout<<po[i]+1;
                    break;
                }
            }
        }
    }
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

/// Typedef
typedef long long ll;

#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)

int main()
{
    ll n,cnt=0;
    cin>>n;

    while(n)
    {
        if(n%2!=0)
        {
            cnt++;
        }
        n/=2;
    }

    return 0;

    return 0;
}

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

int main()
{
    int x , v1 = 1, bac = 1 , sum = 0;
    cin >> x;
    while(1)
    {
        v1 *= 2;
        if(v1 > x)
        {
            v1 /= 2;
            break;
        }

        else if(v1 == x)
        {
            cout << bac;
            return 0;
        }
    }

    x -= v1;
    while(1)
    {
        ++bac;
        v1 = 1;
        sum += (v1 * 2);
        if(sum >= x)
        {
            cout << bac;
            return 0;
        }

    }

    return 0;

}

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long n , x1 , x2 ;
    cin >> n ;
    x2 = ceil(log2(n));
    for (int i = 0 ; true ;  i++)
    {
        long long tmp =pow(2,i);
        if (tmp > n)
        {
            x1 = n - pow (2,i-1);
            break;
        }
    }
    x1++;
    (x1 < x2)? cout << x1 : cout << x2;
    return 0;
}

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

int main(){
        int see,put_bacteria;
	cin>>put_bacteria;
	//while(put_bacteria>0){
	for(int i=put_bacteria;i<put_bacteria;i++){
	see=see+put_bacteria%2;
		put_bacteria=put_bacteria/2;
	}

	cout<<see;
        return 0;
}

///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define PB(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{

    //freopen("Input.txt","r",stdin);
	//freopen("Output.txt","w",stdout);
	long long n,p,i;
while(cin>>n)
	{
	   if(n%2==0)cout<<1<<endl;
	   else cout<<2<<endl;
    }
return 0;
}

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int x,n=1;
    cin>>x;
    float k=log10(x)/log10(2);

   int v = static_cast<int>(k);
if(k == v)
    cout<<n<<endl ;
else
    cout <<n+(x-pow(2,v))<<endl;

    return 0;
}

#include <stdio.h>

int main()
{
    long x;
    int t=0;

    scanf("%ld",&x);

    while (x>=2)
    {
        t+=x%2;
        x=x/2;
    }

    printf("%d",t);

    return 0;
}

#include<bits/stdc++.h>
using namespace  std;
int main()
{
    double n;
    int x,count=1;
    cin>>x;
    while(x>0)
    {
       n=log10(x)/log10(2);
       x=x-pow(2,int(n));
       if(x!=0)
       {
           count++;
       }
    }
    cout<<count;
}

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORR(i, a, b) for (int i = a; i <= b; i++)
#define REP(i, a, b) for (int i = b - 1; i >= a; i--)
#define FORI(i, a, b, inc) for (int i = a; i <= b; i += inc)
#define FORRI(i, a, b, inc) for (int i = a; i < b; i += inc)
#define REPD(i, a, b, dec) for (int i = b - 1; i >= a; i -= dec)
#define SORT(a, n) sort(a, a + n, greater<int>())
#define PREC(n) cout << fixed << setprecision(n)
#define ULL unsigned long long
#define LL long long
#define Vsort(v) sort(v.begin(), v.end())
#define RESET(a, b) memset(a, b, sizeof(a))
#define PI acos(-1)
#define VSE(v) v.begin(), v.end()
#define S " "
int isPrime(LL n)
{
	for (LL i = 2; i * i <= n; i++)
		if (n % i == 0)
			return 0;
	return 1;
}
void solve()
{
	long long n, cl, sum = 0;
	float x;
	cin >> n;
	while (1)
	{
		x = log(n) / log(2);
		cl = floor(x);
		if (cl == x)
		{
			cout<<sum+1<<endl;
			break;
		}
		else
		{
			x = pow(2, cl);
			n = n - x;
			sum++;
		}
	}
}
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

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

	/*int t = 1;
	cin >> t;
	while (t--)*/
		solve();
	return 0;
}

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <conio.h>
#include <algorithm>
#include <limits>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <new>
#include <utility>
#include <map>
// Khaled Alam  'Ninjo' ^^

using namespace std;

int main()
{

    int x,y=1;
    cin>>x;

            if( x == 0)
            {
              cout<<0<<endl;
              return 0;
            }
            if(x == 1)
            {
                cout<<1<<endl;
                return 0;
            }

        for(int i=0; i<x*10; i++)
        {
                // 7  > 1 2 4 8  | 1 + 3
                // 5  > 1 2 4 8  | 1 + 1
                // 8  > 1 2 4 8  | 1
                // 20 > 1 2 4 8 16 32
            y = y * 2;

            if(y == x)
            {
               y = 1;
               cout<<y<<endl;
               return 0;

            }else if( y > x)
            {
                y = y/2;
                y = x - y;
                y = y+1;
                cout<<y<<endl;
                return 0;
            }
        }

    return 0;
}

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

int main()
{
    int a,b,i,s=0;
    scanf("%d %d",&a,&b);
    for(i=1;i<=a;i++)
    {
        if(b%i==0)
        {
            if((b/i)<=a)
            {
                s++;
            }
        }
    }
    printf("%d\n",s);
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

#define fst first
#define snd second
#define EPS 1e-7
#define PI 2*acos(0.0)
#define inf (1<<29)
#define akbarbe ceil
#define akkombe floor
#define bug(x) cout<<#x<<" = "<<x<<endl
#define N 1001
#define LL long long
#define delect(str) str.erase(std::remove_if(str.begin(), str.end(), str[i]), str.end());

int x[] = {-1, 0, 0, 1, 1, -1, -1, 1};
int y[] = {0, -1, 1, 0, 1, -1, 1, -1};

int dx[] = {+1,+1,+2,+2,-1,-1,-2,-2};
int dy[] = {+2,-2,+1,-1,+2,-2,+1,-1};

int main()
{
    LL x;
    while(cin>>x)
    {
       int c=0;
        while(x)
        {
             if(x&1) c++;
             x>>=1;
             cout<<x<<endl;
        }
        cout<<c<<endl;
    }

    return 0;
}

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

#include <iostream>

using namespace std;

int main()
{ long long x,n=1,s=1;
cin>>x;

while(n!=x){
        if (n%2!=0)
        s++;
    n*=2;
    if (n>x)
       {
        n=n/2;
        n=x-n;
        while(n!=1)
        {n=n/2;
        if(n%2!=0)
       s++;}

       n=x;}
       }

cout<<s;

    return 0;
}

/*
URL_HERE
*/
/*

*/
#ifdef _WIN32
#pragma warning(disable:4996)
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <limits.h>
#include <queue>
#include <iostream>
using namespace std;

FILE* _fin = stdin;
FILE* _fout = stdout;
#define PI 3.141592653589793238462643383279502884197169399375105820974
#define ten5p1 100001
#define ten6p1 1000001
#define ten8p1 100000001
#define ten9p1 1000000001
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define rep(var,n) for(int var=0;var<n;++var)
#define repi(n) rep(i,n)
#define repj(n) rep(j,n)
#define repi1(n) for(int i=1;i<n;++i)
#define repj1(n) for(int j=1;j<n;++j)
int _min(int a, int b) { return a <= b ? a : b; }
int _min(ll a, ll b) { return a <= b ? a : b; }
int _max(int a, int b) { return a >= b ? a : b; }
ll _max(ll a, ll b) { return a >= b ? a : b; }
void zero(int* data, int n) { memset(data, 0, sizeof(int) * n); }
void zero(ll* data, int n) { memset(data, 0, sizeof(ll) * n); }
void zero(unsigned long long* data, int n) { memset(data, 0, sizeof(unsigned long long) * n); }
void zero(char* data, int n) { memset(data, 0, sizeof(char) * n); }
char readc() { char var; fscanf(_fin, "%c", &var); return var; }
int readi() { int var; fscanf(_fin, "%d", &var); return var; }
double readlf() { double var; fscanf(_fin, "%lf", &var); return var; }
ll readll() { ll var; fscanf(_fin, "%lld", &var); return var; }
void repread(int* data, int n) { repi(n) data[i] = readi(); }
void repread(ll* data, int n) { repi(n) data[i] = readll(); }
int reads(char* str, int maxsize)
{
	for (;;) { if (fgets(str, maxsize, _fin) == NULL) break; if (str[0] != '\n' && str[0] != '\r') break; }
	int slen = strlen(str); if (slen == 0) return 0;
	if (str[slen - 1] == '\n' || str[slen - 1] == '\r') str[--slen] = 0;
	return slen;
}

#define writec(var) fprintf(_fout,"%c",var)
#define writecsp(var) fprintf(_fout,"%c ",var)
#define writecln(var) fprintf(_fout,"%c\n",var)
#define writei(var) fprintf(_fout,"%d",var)
#define writeisp(var) fprintf(_fout,"%d ",var)
#define writellsp(var) fprintf(_fout,"%lld ",var)
#define writeiln(var) fprintf(_fout,"%d\n",var)
#define writellln(var) fprintf(_fout,"%lld\n",var)
#define writeulln(var) fprintf(_fout,"%llu\n",var)
#define writefln(var) fprintf(_fout,"%f\n",var)
#define writes(str) fprintf(_fout,"%s",str)
#define writesp() fprintf(_fout," ")
#define writeln() fprintf(_fout,"\n")
#define RUN_LOCAL(testfilename) {_fin = fopen(testfilename, "r"); if(_fin==NULL) _fin=stdin;}
#define swap(type,a, b) {type t=a;a=b;b=t;}
#define sort(data,n) std::sort(data,data+n)
//#define mod(a,b) b==0 ? 0 : a==0 ? 0 :(a>0 ? a%b : b + a % b) //what the hell is this...
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return (a / g) * b; }
void reverse(char* data, int n) { int k = n >> 1; repi(k) { char tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }
void reverse(int* data, int n) { int k = n >> 1; repi(k) { int tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }
void reverse(ll* data, int n) { int k = n >> 1; repi(k) { ll tmp = data[i]; data[i] = data[n - i - 1]; data[n - i - 1] = tmp; } }

#define _Vec(type, name) \
struct name { type* data; int size; int n; };\
void init(name* t, int size) { t->data = (type*)malloc(sizeof(type) * size); t->size = size; t->n = 0; }\
void resize(name* t) { int ns = t->size * 1.2f; t->data = (type*)realloc(t->data, sizeof(type) * ns); t->size = ns; }\
void add(name* t, type val) { if (t->n >= t->size) resize(t); int k = t->n; t->data[k] = val; t->n = k + 1; }\
void free(name* t) { free(t->data);}
_Vec(int, Veci)
_Vec(long long, Vecll)
_Vec(char*, Vecs)

#define _ispal(type, name) int name(type* a, type* b, int n){repi(n){if (a[i] != b[n - i - 1]){return 0;}}return 1;}
_ispal(int, ispali)
_ispal(char, ispalc)

#define _Pair(type, name) struct name{type x, y;}; \
int cmp_##name(const void* _a, const void* _b)\
{\
	name* a = (name*)_a;name* b = (name*)_b;\
	if (a->x < b->x) return -1;\
	else\
	{\
		if (a->x == b->x)\
		{\
			if (a->y == b->y) return 0;\
			if (a->y < b->y) return -1;\
			else return 1;\
		}\
		else\
		{\
			return 1;\
		}\
	}\
}\
void sort_##name(name* d, int n){qsort(d, n, sizeof(name), cmp_##name);}
	_Pair(int, Pairi)
	_Pair(double,Pairlf)

	int cmp_Str(const void* _a, const void* _b) { char* a = *((char**)_a); char* b = *((char**)_b); return strcmp(a, b); }
void sort_Str(char** str, int n) { qsort(str, n, sizeof(char*), cmp_Str); }

ll expmod(ll x, ll n, ll m) {
	ll ans = 1;
	for (; n;) {
		if (n & 1) ans = (ans * x) % m;
		x = (x * x) % m;
		n >>= 1;
	}
	return ans;
}

ll combmod(ll n, ll k, ll m) {
	ll ret = 1;
	ll div = 1;
	for (ll i = 0; i < k; ++i) {
		ret = (ret * (n - i) % m) % m;
		div = (div * (i + 1)) % m;
	}
	div = expmod(div, m - 2, m) % m;
	return (ret * div) % m;
}

int next_perm(int* data, int n)
{
	//find first i,i+1 where d[i]<d[i+1]
	int rootidx = -1;
	for (int i = n - 2; i >= 0; --i)
	{
		if (data[i] < data[i + 1])
		{
			rootidx = i;
			break;
		}
	}

	if (rootidx == -1) return 0;

	int ceilingidx = rootidx + 1;
	//find smallest d[x] after d[rooti] where d[x]>d[rooti]
	for (int i = rootidx + 2; i < n; ++i)
	{
		if (data[i] > data[rootidx] && data[i] < data[ceilingidx])
		{
			ceilingidx = i;
		}
	}

	swap(int, data[rootidx], data[ceilingidx]);
	sort(&data[rootidx + 1], n - rootidx - 1);
	return 1;
}
int count_digits(ll a)
{
	int k = 0;
	for (;;)
	{
		if (a == 0)break;
		k++;
		a /= 10;
	}
	return k;
}

/*
use only when val EXISTS in data
*/
int bs_exists(int* data, int n, int val)
{
	int left = 0;
	int right = n - 1;
	for (; left < right;)
	{
		int mid = (left + right + 1) >> 1;
		if (data[mid] <= val) left = mid;
		else right = mid - 1;
	}
	return right;
}

double simple_factorial(int x)
{
	double f = 1.0;
	repi(x)
	{
		f *= (i + 1);
	}
	return f;
}

unsigned long long djb2(char* data, int n)
{
	unsigned long long h = 5381;
	for (int i = 0; i < n; ++i) h = (h << 5) + h + data[i];
	return h;
}

struct Hashcount
{
	int* count;
	unsigned long long* keys;
	int size_bits;
};
void init(Hashcount* h, int size_bits)
{
	h->size_bits = size_bits;
	int size = 1 << h->size_bits;
	h->count = (int*)malloc(sizeof(int) * size);
	zero(h->count, size);
	h->keys = (unsigned long long*)malloc(sizeof(unsigned long long) * size);
	zero(h->keys, size);
}

int set(Hashcount* h, unsigned long long key)
{
	//knuth's golden ratio multiplicative hashing for 64-bit keys
	int index = (key * 2654435761) >> (64 - h->size_bits);
	int size = 1 << h->size_bits;
	for (int i = 0; i < size; i++)
	{
		if (h->keys[index] == key) //if key exists, overwrite data
		{
			h->count[index]++;
			return index;
		}

		if (h->keys[index] == 0) //empty spot
		{
			h->count[index] = 1;
			h->keys[index] = key;
			return index;
		}

		index++;
		index &= size - 1;
	}

	return -1;//return invalid index if data was not placed. this could be used as an indicator to resize.
}

int get(Hashcount* h, unsigned long long key)
{
	int index = (key * 2654435761) >> (64 - h->size_bits);
	int size = 1 << h->size_bits;
	for (int i = 0; i < size; i++)
	{
		if (h->keys[index] == key)//found original key
		{
			return h->count[index];
		}

		if (h->keys[index] == 0) return 0;//if you see a zero,key was never there

		index++;
		index &= size - 1;
	}
	return 0;
}
//not sure if this works
int sub(Hashcount* h, unsigned long long key)
{
	int index = (key * 2654435761) >> (64 - h->size_bits);
	int size = 1 << h->size_bits;
	for (int i = 0; i < size; i++)
	{
		if (h->keys[index] == key)//found original key
		{
			--h->count[index];
			if (h->count[index] < 0) h->count[index] = 0;
			return h->count[index];
		}

		if (h->keys[index] == 0) return 0;//if you see a zero,key was never there

		index++;
		index &= size - 1;
	}
	return 0;
}

const ll MOD  = 1e9 + 7;

//------------------------------------------

//------------

int main()
{

	RUN_LOCAL("input.txt");
	int x = readi();
	int current = 1;
	int ans = 0;
	for (;;)
	{
		if ((current << 1) > x)
		{
			ans = x - current;
			break;
		}
		current <<= 1;
	}
	ans += 1;
	printf("%d\n", ans);
	return 0;
}

#include <bits/stdc++.h>
int main(){
    int n;
    std::cin>>n;
    if(n%2==0)
    std::cout<<'1';
    else
    std::cout<<'2';

}

#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    int i,l=0,a[1000],n,j=0,c=0;
    char s[100];
    cin>>s;
    for(i=0;s[i]!='\0';i++)
      {
         n=s[i]-'0';
         while(n>0)
          {
            a[j]=n%2;
            j++;
            n=n/2;
            }
      }
      for(i=j;i>=0;i--)
        if(a[i]==1)
           c++;
           cout<<c;

     return 0;
}

#include <bits/stdc++.h>

using namespace std;

int count(long long x)
{
    long long ans = 1;
    while (ans <= x)
    {
        ans <<= 1;
    }
    ans >>= 1;
    return (x - ans) + 1;
}

int main()
{
    int x;
    cin >> x;
    cout << count(x) << "\n";
    return 0;//
}

#include<bits/stdc++.h>

using namespace std;

#define fst first
#define snd second
#define EPS 1e-7
#define PI 2*acos(0.0)
#define inf (1<<29)
#define akbarbe ceil
#define akkombe floor
#define bug(x) cout<<#x<<" = "<<x<<endl
#define N 1001
#define LL long long
#define delect(str) str.erase(std::remove_if(str.begin(), str.end(), str[i]), str.end());

int x[] = {-1, 0, 0, 1, 1, -1, -1, 1};
int y[] = {0, -1, 1, 0, 1, -1, 1, -1};

int dx[] = {+1,+1,+2,+2,-1,-1,-2,-2};
int dy[] = {+2,-2,+1,-1,+2,-2,+1,-1};

int main()
{
    LL x;
    while(cin>>x)
    {
      if(x==1) {
         cout<<"1"<<endl; continue;
      }
       if(x&1)
       {
          cout<<"2"<<endl;
       }
       else cout<<"1"<<endl;
    }
    return 0;
}

#include <iostream>
using namespace std;
int main(){
    int x;
    int res;
    cin >> x;
    if (x == 1 || x == 2){
        cout << 1 << endl;
        return 0;
    }
    for (int i = 1; ;){
        if (i * 2 > x){
            break;
        }
        i *= 2;
        res = i;
    }
    cout << x - res + 1 << endl;
    return 0;
}

#include <iostream>

using namespace std;

int main() {
	// ...
	int n;
	cin >> n;

	if (n % 2 == 0)
		cout << 1;
	else
		cout << 2;

	return 0;
}

#include<iostream>
#include<string>
#include<algorithm>
#include <functional>
typedef long long ll;
using namespace std;
int main()
{
	long long int x;
	cin>>x;
	if(x % 2 == 0)
		cout<<1;
	else
		cout<<2;
	return 0;
}

#include<iostream>
#include<cmath>
using namespace std;
int main()
{int x,f=1;
cin>>x;
int a=sqrt(x);
if(x>=1&&x<=pow(10,9) )
{for(int i=0;i<=a;i++)
 {if(x>pow(2,i)&&x<pow(2,i+1))
{ ++f;}}
   cout<<f<<endl;}
   return 0; }

#include<stdio.h>
using namespace std;

int n;

int main(){
    scanf("%d",&n);
    if(n%2==0)printf("1");
    else printf("2");
}

#include <iostream>

using namespace std;

int main()
{
    int Cnt = 0;
    long long arr[30];
    for(long long i=1;i<1000000001;i*=2)
    {
//        cout << i << endl;
        arr[Cnt] = i;
        Cnt++;
    }
//    cout << Cnt << endl;

//    cout << arr[29] << endl;

    long long n;
    cin >> n;
//
    long long Match = 0;
    long long BrkPoint = 0;
    long long AnsCnt = 0;
    long long BrkAns;
    for(long long i=0;i<30-1;i++)
    {
        if(n == arr[i])
        {
            Match++;
            break;
        }
        else if(n>arr[i] && n<arr[i+1])
        {
            BrkAns = arr[i];
            BrkPoint++;
            break;
        }
        AnsCnt++;
    }

    if(Match != 0 && BrkPoint == 0)cout << 1 << endl;

    else if(Match == 0 && BrkPoint != 0)cout << AnsCnt << endl;

    else if(Match ==0 && BrkPoint == 0) /// meaning it is greater than arr[29]
    {
        cout << 30 << endl;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define f(i,n) for(int i=0;i<n;i++)
#define endl "\n"
#define F first
#define S second
#define B begin
#define E end
#define Q queue<lli>
#define V vector<lli>
#define M map<lli,lli>
#define P pair<lli,lli>
#define push push_back
typedef long long int lli;
#define tape ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
int main()
{
	tape;
	lli n;
	cin>>n;
	lli count=0;
while(n/2!=0)
{
	count++;
	n=n/2;
}
cout<<count;
return 0;
}

#include<iostream>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<sstream>
#include<bitset>
#include<cstring>
#include<stdio.h>
#include<math.h>
#include<cmath>

using namespace std;
typedef long long int ll;
typedef vector<ll>vl;
typedef long double ld;

#define cn(n)  scanf("%lld", &n)
#define FileIn(file) freopen(file".in", "r", stdin)
//freopen("morty.in" , "r" , stdin);
#define FileOut(file) freopen(file".out", "w", stdout)
#define F(i, a, b) for (int i=a; i<=b; i++)
#define rep(i, n) for (int i=0; i<n; i++)
#define Fill(ar, val) memset(ar, val, sizeof(ar))
#define bit(n) (1<<(n))
#define   fn           "\n"
//#define PI  3.14159265358979323846
ll gcd(ll a, ll b)
{
    if (b == 0)
    {
        return a;
    }
    return gcd(b, a % b);
}
void Abdo()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
//3.141592653589793238462643 38327950288419716939937510582097494459;
int dx[]= {0, -1, -1, -1, 0, 1, 1,  1};
int dy[]= {-1, -1,  0,  1, 1, 1, 0, -1};
const ld EPS = 1e-9, PI = 3.1415926535897932384626433832795;

const long long N = 1e4 + 5, M = 1e5 +5, OO = 0x3f3f3f3f, MOD = 1e9+7;
bool PowOfTwo(int n){
	return (!(n&(n-1)));
}

bool isPowerOfTwo(int n)
{
  if (n == 0)
    return 0;
  while (n != 1)
  {
      if (n%2 != 0)
         return 0;
      n = n/2;
  }
  return 1;
}
int prevPow(int n){
	int p = (int)log2(n);
	return (int)pow(2,p);

}
int main()
{
	int n , ans = 1 ;
	cin>>n;
	if(isPowerOfTwo(n))cout<<"yes"<<fn;
	ans += (n-prevPow(n));
	cout<<ans<<fn;
    return 0;
}

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

// Last modify : 2019年01月09日 星期三 22时51分04秒
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
long long PF[33];
int main()
{
    for (int i = 0; i <= 32; i++) PF[i] = pow(2, i);
    long long n;
    cin >> n;
    long long * pt = lower_bound(PF, PF+33, n);
    if (*pt == n) cout << 1 << endl;
    else
    {
        pt--;
        cout << n - *pt + 1 << endl;
    }

    return 0;
}
//2019-01-09 23:18:24.906

#include<stdio.h>
#include<math.h>
int main(){
	long long int n,v,x,i,min;
	double n1;
	scanf("%I64d",&x);
	min=x;
	n=log(x)/log(2);
	n1=(double)n;
	for(i=1;i<15;i++){
	if(x-i*pow(2,n1)+i<=min)min=x-i*pow(2,n1)+i;
	n1--;
	}
	printf("%I64d",min);
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,s=0,k=0;
    cin>>n;
    if (n%2==0){
    cout<<"1"<<endl;
    return 0;
    }
    s = (n / 2);
    for (int i = n;i%2!=0;i++){
        cout<<i/2;
        return 0;
}
    return 0;
}

#include<iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	if (n == 1) cout << 1;
	else{
		if (n == 0) cout << 0;
		else{
			int  t = 1;
			while (t <= n){
				t *= 2;
			}
			cout << n + 1 - t / 2;
		}
	}

	return 0;
}

#include <iostream>
using namespace std;

int num(int n)
{
	int bacteria = 0;
	int bacteria_in = 0;
	while (bacteria <= n)
	{
		bacteria_in++;//morning
		bacteria++;//morning

		bacteria *= 2;//night

	}
	return bacteria_in;
}
int main() {

	int x;
	cin >> x;
	cout << num(x);

	return 0;
}

#include<iostream>
#include<math.h>
int main()
{
   int x;
   scanf("%d",&x);
   int i=0;
    while((pow(2,i))<x)
   {
       i++;
   }
   if(((2^i)-x)==0)
   printf("1\n");
   else
   {

      printf("%d\n",(x-(2^(i-1)))+1);
   }
 return 0;
}

#include<iostream>
using namespace std;
int main()
{
int x;
cin>>x;
for(int i=1;i<20;i++)
{
int c=1,m;
for(int j=1;j<i;j++){
c=c*2;m=c*2;
if(x>c && x<m)
cout<<x-c+1<<endl;}
}
}

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

int main()
{
	int x;
	bool flag = true;

	cin >> x;

	int i = 0;
	while (flag)
	{
		if (pow(2, i) > x)
		{
			flag = false;
		}
		else
			i++;
	}

	cout << 1 + (x - pow(2, i - 1));
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    if(n&2)cout<<"2";
    else cout<<"1";
	// your code goes here
	return 0;
}

#include<iostream>
//#include<math.h>
#include<conio.h>
using namespace std;
int main()
{
    unsigned long long int x,temp,pow=2;

    cin>>x;
    temp=x;
    while(1)
    {
        if(x==pow)
        {
            cout<<1;
            break;
        }
        else if(x<pow)
        {
            x=x-pow/2;
        cout<<x+1;
            break;

        }
        pow=pow*2;

    }

  ///  getch();
    return 0;
}

#include <iostream>
using namespace std;
unsigned long int bak(unsigned long int k)
{
    unsigned long int i=1;
    while(k!=i && i<k)
    {
        i*=2;
    }
    if(k==i)return 1;
    else
        return k-i/2+1;
}
int main()
{
    unsigned long int x;
    cin>>x;
   unsigned long int k=0;

   while(x%2==0)
   {
       x/=2;
   }
   cout<<bak(x)<<"\n";

}

#include  <iostream>
using namespace std;
int main (){
	int n,sum=1,s=1,sum1=1,c=1;
	cin>>n;
	for (int i=1;i >0;i++)
	if (sum*2 <=n){
		sum=sum*2;
		s++;}
		else if (sum*2>n)
		break;
		if (sum <n){
		for (int i=0;i <s;i++)
		sum1=sum1*2;
		if (sum+sum1<=n)
		c++;
		else
		c=c+(n-sum);}
		cout <<c;
}

#include<iostream>
using namespace std;

int main() {
	int x,num;
	num = 1;
	cin >> x;
	num += (x % 2);
	cout << num << endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>

using namespace std;

int  main()
{
	int k;
	cin >> k;
	int j = k;
	int sum = 0;
		int u = 1;
		while (u * 2 <= k)
		{
			u *= 2;
		}

				while (j != 1)
				{
					if (j%2==0)
					j /= 2;
					else { j--; sum++; }
				}
			sum += j+1;

		cout << min(sum ,k - u + 1);
	     return 0;

}