    import java.util.*;
     
    public class Main {
        public static void main(String[] args){
            // Your code here!
            Scanner sc = new Scanner(System.in);
            
            int N = sc.nextInt();
            
            int result = 0;
            int maxCount = 0;
            
            for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            }
            
            System.out.println(result);
            
        }
        
    } import java.util.*; util.* java public class Main {
        public static void main(String[] args){
            // Your code here!
            Scanner sc = new Scanner(System.in);
            
            int N = sc.nextInt();
            
            int result = 0;
            int maxCount = 0;
            
            for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            }
            
            System.out.println(result);
            
        }
        
    } Main public static void main(String[] args){
            // Your code here!
            Scanner sc = new Scanner(System.in);
            
            int N = sc.nextInt();
            
            int result = 0;
            int maxCount = 0;
            
            for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            }
            
            System.out.println(result);
            
        } main {
            // Your code here!
            Scanner sc = new Scanner(System.in);
            
            int N = sc.nextInt();
            
            int result = 0;
            int maxCount = 0;
            
            for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            }
            
            System.out.println(result);
            
        } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int result = 0; result 0 int maxCount = 0; maxCount 0 for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            } {
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            } int count = 0; count 0 int num = i; num i while((num % 2) == 0){
                    count++;
                    num = num/2;
                } (num % 2) == 0 (num % 2) num 2 0 {
                    count++;
                    num = num/2;
                } count++ count num = num/2 num num/2 num 2 if(count >= maxCount){
                    maxCount = count;
                    result = i;
                } count >= maxCount count maxCount {
                    maxCount = count;
                    result = i;
                } maxCount = count maxCount count result = i result i System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
        public static void main(String[] args){
            // Your code here!
            Scanner sc = new Scanner(System.in);
            
            int N = sc.nextInt();
            
            int result = 0;
            int maxCount = 0;
            
            for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            }
            
            System.out.println(result);
            
        }
        
    } public class Main {
        public static void main(String[] args){
            // Your code here!
            Scanner sc = new Scanner(System.in);
            
            int N = sc.nextInt();
            
            int result = 0;
            int maxCount = 0;
            
            for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            }
            
            System.out.println(result);
            
        }
        
    } Main
    import java.util.*;
     
    public class Main {
        public static void main(String[] args){
            // Your code here!
            Scanner sc = new Scanner(System.in);
            
            int N = sc.nextInt();
            
            int result = 0;
            int maxCount = 0;
            
            for(int i = 1; i <= N; i++){
                
                int count = 0;
                int num = i;
                
                while((num % 2) == 0){
                    count++;
                    num = num/2;
                }
                if(count >= maxCount){
                    maxCount = count;
                    result = i;
                }
            }
            
            System.out.println(result);
            
        }
        
    }