import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
} 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 maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		System.out.println(ans);
	} main {

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		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 maxCnt = 0; maxCnt 0 int ans = 1; ans 1 for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		} int i=1; int i=1; i 1 i<=n i n i++ i++ i {

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		} {

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		} int num = i; num i int cnt = 0; cnt 0 while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			} true {
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			} if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				} num % 2 == 0 && num != 0 num % 2 == 0 num % 2 num 2 0 num != 0 num 0 {
					num = num /2;
					cnt++;
				} num = num /2 num num /2 num 2 cnt++ cnt {
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				} if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					} maxCnt < cnt maxCnt cnt {
						maxCnt = cnt;
						ans = i;
					} maxCnt = cnt maxCnt cnt ans = i ans i break; 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 maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
} 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 maxCnt = 0;
		int ans = 1;
		
		for(int i=1; i<=n; i++){

			int num = i;
			int cnt = 0;
			
			while(true){
	
				if(num % 2 == 0 && num != 0){
					num = num /2;
					cnt++;
				}
				else{
					if(maxCnt < cnt){
						maxCnt = cnt;
						ans = i;
					}
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
}