function Main(input) {
	input = parseInt(input.trim());
  var output = 1; 
  var maxCount = 0;
  for(var i = 1; i < input; i++){
    var tmp = i;
    var count = 0;
    while(tmp % 2 != 1){
       tmp = tmp / 2;
       count++;
    }
    if(maxCount < count){
       output = i;
       maxCount = count;
    }
   }
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
