#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repi(i, a, b) for (long long i = (long long)(a); i < (long long)(b); i++)
#define drep(i, n) for (long long i = n - 1; i > 0; i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()

using namespace std;

int main()
{
    /* //run time error が出ました．一つだけ．．．
    //ABC 093 B
    int a, b, n;
    cin >> a >> b >> n;
    bool print_judge[b - a + 2] = {false};
    for (int i = 0; i < n; i++)
    {
        if (i == b - a + 1)
        {
            break;
        }
        print_judge[i] = true;
    }
    for (int i = b - a; i > b - a - n; i--)
    {
        if (i < 0)
        {
            break;
        }
        print_judge[i] = true;
    }
    int cnt = 0;
    for (int i = 0; i <= b - a; i++)
    {
        if (print_judge[i] == true)
        {
            cout << a + i << " ";
        }
    }
    cout << "\n";

    return 0;
*/

    // ABC 091 B
    /*      //まだ途中
    int n
    cin >> n ;
    string s[101];
    int s_collection[101] = {0};
    for(int i = 0; i<n;i++){
        cin >> s[i];
    }
    cin >> m;
    string t[101];
    for(int i = 0; i<m ;i++){
        cin >> t[i];
    }
    */
    /*
    //ABC 090 B
    //いくつかWAがある
    int a, b;
    cin >> a >> b;
    int a_1, a_10, a_100, a_1000, a_10000;
    int ans = 0;
    while (a != b)
    {
        a_1 = a % 10, a_10 = (a / 10) % 10, a_1000 = (a / 1000) % 10, a_10000 = (a / 10000);
        if (a_1 == a_10000 && a_10 == a_1000)
        {
            ans++;
        }
        a++;
    }
    cout << ans << endl;
    return 0;
    */
    // ABC 089 B
    /*
    int n;
    cin >> n;
    char s;
    for (int i = 0; i < n; i++)
    {
        cin >> s;

        if (s == 'Y')
        {
            cout << "Four\n";
            return 0;
        }
    }
    cout << "Three\n";
    return 0;
    */
    // ABC 088 B
    /*
    int n;
    cin >> n;
    int a[101];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = n - 1; i < j; j--)
        {
            if (a[j] > a[j - 1])
            {
                int tmp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = tmp;
            }
        }
    }
    int Alice = 0, BOB = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 == 0)
        {
            Alice += a[i];
        }
        else
        {
            BOB += a[i];
        }
    }
    cout << Alice - BOB << endl;
    return 0;
    */
    /*
    char c[6];
    for (int i = 0; i < 6; i++)
    {
        cin >> c[i];
    }
    if (c[0] == c[5] && c[1] == c[4] && c[2] == c[3])
    {
        cout << "YES\n";
        return 0;
    }
    else
    {
        cout << "NO\n";
        return 0;
    }*/

    //ABC 094 B
    /*
    int n,m,x;
    cin >> n >> m >> x;
    bool a[n+1] = {false};
    int tmp = 0;
    for(int i = 0;i<m;i++)
    {
        cin >> tmp;
        a[tmp] = true;
    }
    int sum_left = 0;
    for(int i = 0;i<x;i++)
    {
        if(a[i])
        {
            sum_left++;
        }
    }
    int sum_right = 0;
    for(int i = x; i<n ; i++)
    {
        if(a[i])
        {
            sum_right++;
        }
    }
    cout << min(sum_left,sum_right) << endl;
    return 0;
    */

    //ABC 087 B
    /*
   int a,b,c,x,ans_sum = 0;
   cin >> a >> b >> c >> x;
   for(int i = 0;i<=a;i++)
   {
       for(int j = 0;j<=b;j++)
       {
           for(int k = 0;k<=c;k++)
           {
               if(x == i*500+j*100+k*50)
               {
                   ans_sum++;
               }
           }
       }
   }
   cout << ans_sum << endl;
   return 0;
    */

    //ABC 086 B
    /*
   string a,b;
   cin >> a >> b;
   a = a+b;
   int ans = stoi(a);
   for(int i = 1; i<101;i++)
   {
       if(ans%i==0 && ans/i == i)
       {
           cout << "Yes" << endl;
           return 0;
       }
   }
   cout << "No" << endl;
   return 0;
   */

    //ABC 085 B
    /*
    int n;
    cin >> n;
    int d[n];
    for(int i = 0;i<n;i++)
    {
        cin >> d[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j = n-1;j>i;j--)
        {
            if(d[j]<d[j-1])
            {
                int tmp = d[j];
                d[j] = d[j-1];
                d[j-1] = tmp;
            }
        }
    }
    int sum = 0;
    for(int i = 0;i<n;i++)
    {
        if(d[i]<d[i+1])
        {
            sum++;
        }
    }
    cout << sum << endl;
    return 0;
    */
    int n;
    cin >> n;
    int tmp, ans, cnt, ans_cnt = -1;
    for (int i = 1; i <= n; i++)
    {
        tmp = i;
        cnt = 0;
        while (tmp % 2 == 0 && tmp > 0)
        {
            tmp /= 2;
            cnt++;
        }
        if (cnt > ans_cnt)
        {
            ans_cnt = cnt;
            ans = i;
        }
    }
    cout << ans << endl;
  	return 0;
}


Measured memory_bytes: 256