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

function Main(args){
    input = args.split("\n");
    const N = parseInt(input[0]);
    var count = 0;
    var maxCount = 0;
    var result = 1;

    for(var i=1; i<=N; i++){
        count = 0;
        var j = i;
        while(true){
            if(j%2 ==0){
                count++;
                j /= 2;
            }else{
                break;
            }

            if(maxCount < count){
                maxCount = count;
                result = i;
            }
        }
    }

    console.log(result);
}