import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int ansi=1;
			int ans=0;
			int tmp=0;
			int X=0;
						
			for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			}
			System.out.println(ansi);
		}
} 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 ansi=1;
			int ans=0;
			int tmp=0;
			int X=0;
						
			for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			}
			System.out.println(ansi);
		}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int ansi=1;
			int ans=0;
			int tmp=0;
			int X=0;
						
			for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			}
			System.out.println(ansi);
		} main {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int ansi=1;
			int ans=0;
			int tmp=0;
			int X=0;
						
			for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			}
			System.out.println(ansi);
		} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N =sc.nextInt(); N sc.nextInt() sc.nextInt sc int ansi=1; ansi 1 int ans=0; ans 0 int tmp=0; tmp 0 int X=0; X 0 for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			} int i=1; int i=1; i 1 i<N+1 i N+1 N 1 i++ i++ i {
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			} {
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			} tmp=0 tmp 0 X=i X i for(;X%2==0;){
					tmp++;		
					X=X/2;
				} ; X%2==0 X%2 X 2 0 {
					tmp++;		
					X=X/2;
				} {
					tmp++;		
					X=X/2;
				} tmp++ tmp X=X/2 X X/2 X 2 if(tmp>ans){
					ans=tmp;
					ansi=i;
				} tmp>ans tmp ans {
					ans=tmp;
					ansi=i;
				} ans=tmp ans tmp ansi=i ansi i System.out.println(ansi) System.out.println System.out System System.out ansi String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int ansi=1;
			int ans=0;
			int tmp=0;
			int X=0;
						
			for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			}
			System.out.println(ansi);
		}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int ansi=1;
			int ans=0;
			int tmp=0;
			int X=0;
						
			for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			}
			System.out.println(ansi);
		}
} 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 ansi=1;
			int ans=0;
			int tmp=0;
			int X=0;
						
			for(int i=1;i<N+1;i++){
				tmp=0;
				 X=i;
				for(;X%2==0;){
					tmp++;		
					X=X/2;
				}
				if(tmp>ans){
					ans=tmp;
					ansi=i;
				}
			}
			System.out.println(ansi);
		}
}