function count(n) {
    var c = 0;
    while (n % 2 === 0) {
        n = Math.floor(n / 2);
        c += 1;
    }
    return c;
}

function Main(inp) {
    var input = inp.split("\n");
    var n = Number(input[0]);
    var max = 0;
    var r = 0;
    for (var i = 1; i <= n; i++) {
        var c = count(i);
        if (c > max) {
            max = c;
            r = i;
        }
    }
    console.log(r);
}

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