#include<iostream>
using namespace std;
int main(){ 
   int n,i;
   cin>>n;
   i = 2;
   while(i < n){ 
     i = i * 2;
   }
   if(i - n < n - i / 2){ 
      cout<<i<<endl;
   }else{ 
      cout<<i / 2 <<endl;
   }
    
   return 0;
}
/**************************************************************
	Problem: 1075
	User: admin
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/