function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0],10);
  let count = 0;
  let max_count = 0;
  let ans = 1;
  for (var n = 1; n <= N; n++) {
    let work_n = n;
    count = 0;
    while (work_n % 2 === 0 && work_n > 0) {
      work_n = work_n / 2;
      count++;
    }
    if (max_count < count) {
      ans = n;
      max_count = count;
    }
  }
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
