Problem

Given the integer n, output the smallest m such that nCm (the number of combinations that choose m out of n different ones) is even.

Constraints

The input satisfies the following conditions.

* 1 ≤ n ≤ 1018

Input

The input is given in the following format.


n


Output

Output the minimum m such that nCm is an even number on one line.

Examples

Input

2


Output

1


Input

111


Output

16


Input

3


Output

4
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define pb push_back

using ll = long long;

ll ct2(ll n)
{
    ll r = 0;
    while(n>0 && n%2==0)
    {
        n/=2;
        ++r;
    }
    return r;
}

ll pw(int x, int n)
{
    ll r = 1;
    rep(i,n) r *=x;
    return r;
}

ll num(int n)
{
    ll ct = 0;
    rep(i,n+1)
    {
        ct += ct2(i);
    }
    return ct;
}

ll C(int n, int m)
{
    ll p = num(n);
    ll q = num(m) + num(n-m);
    // printf("C %d %d %lld\n", n,m,p-q);
    return p-q;
}

void test()
{
    for(int i=3; i<=100000; i+=2)
    {
        printf(" i %d\n", i);
        for(int j=2; j<=i; j+=2)
        {
            if(C(i,j)>0)
            {
                assert(j==pw(2,ct2(i+1)));
                break;
            }
        }
    }
    printf(" END\n");
}

int main()
{
    // test();

    ll n;
    cin >>n;

    cout << pw(2,ct2(n+1)) << endl;
    return 0;
}