import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int max = 0; max 0 int ans = 0; ans 0 for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        } {
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        } int x = i; x i int y = 0; y 0 for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            } int j=1; int j=1; j 1 j<=100 j 100 j++ j++ j {
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            } {
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            } if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                } x%2!=0 x%2 x 2 0 {
                    break;
                } break; {
                    x = x / 2;
                    y += 1;
                } x = x / 2 x x / 2 x 2 y += 1 y 1 max = Math.max(max, y) max Math.max(max, y) Math.max Math max y if(max==y){
                ans = i;
            } max==y max y {
                ans = i;
            } ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        }
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int max = 0;
        int ans = 0;

        for(int i=1; i<=N; i++){
            int x = i;
            int y = 0;
            for(int j=1; j<=100; j++){
                if(x%2!=0){
                    break;
                }
                else{
                    x = x / 2;
                    y += 1;
                }
            }
            max = Math.max(max, y);
            if(max==y){
                ans = i;
            }
        }
        System.out.println(ans);
    }
}