#include <iostream>
#include <cmath>

using namespace std;

main()
{
    freopen("DATA2.txt", "r", stdin);
    freopen("OUT2.txt", "w", stdout);


    int n, t;
    while(true){
        cin >> n;
        if (n == 0)
            cout << 1 << endl;
        else{
            t = round(log(n)/log(2));
            cout << pow(2.0,t) << endl;
        }
    }

    return 0;
}

