import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	    	
    	int all = 1;
    	while(all<=N) {
    			all *= 2;
    	   	}
    	if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	    	
    	int all = 1;
    	while(all<=N) {
    			all *= 2;
    	   	}
    	if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    }
    }
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	    	
    	int all = 1;
    	while(all<=N) {
    			all *= 2;
    	   	}
    	if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    }
    } main {
    
    Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	    	
    	int all = 1;
    	while(all<=N) {
    			all *= 2;
    	   	}
    	if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int all = 1; all 1 while(all<=N) {
    			all *= 2;
    	   	} all<=N all N {
    			all *= 2;
    	   	} all *= 2 all 2 if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    } all>N all N {
    	System.out.println(all/2);
    	} System.out.println(all/2) System.out.println System.out System System.out all/2 all 2 {
    	System.out.println(all);
    } System.out.println(all) System.out.println System.out System System.out all String[] args args public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	    	
    	int all = 1;
    	while(all<=N) {
    			all *= 2;
    	   	}
    	if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    }
    }
} public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	    	
    	int all = 1;
    	while(all<=N) {
    			all *= 2;
    	   	}
    	if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    }
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	    	
    	int all = 1;
    	while(all<=N) {
    			all *= 2;
    	   	}
    	if(all>N) {
    	System.out.println(all/2);
    	}else {
    	System.out.println(all);
    }
    }
}
