#include using namespace std; using ll = long long; ll f(int n){ ll pow = 1; while(n>0){ pow *= 2; n--; } return pow; } int main(){ ll m; cin >> m; int ans = 0; for(int i = 0; i <= 60; i++){ if(f(i)>=m){ ans = i; break; } } cout << f(ans-1) << endl; return 0; }