#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i=1;
cin>>n;
while(i<n){
i*=2;
}
i/=2;
if(i*2-n<n-i){
cout<<i*2;
}else{
cout<<i;
}
}
///**********
/**************************************************************
Problem: 1075
User: fuyijun
Language: C++
Result: Accepted
Time:6 ms
Memory:2072 kb
****************************************************************/