import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int N = Integer.parseInt(sc.next());
        
        int ans = 1;
        int max = 0;
        for(int i=1; i<=N; i++){
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int N = Integer.parseInt(sc.next());
        
        int ans = 1;
        int max = 0;
        for(int i=1; i<=N; i++){
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int N = Integer.parseInt(sc.next());
        
        int ans = 1;
        int max = 0;
        for(int i=1; i<=N; i++){
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        
        int N = Integer.parseInt(sc.next());
        
        int ans = 1;
        int max = 0;
        for(int i=1; i<=N; i++){
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = 1; ans 1 int max = 0; max 0 for(int i=1; i<=N; i++){
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        } {
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        } int n = i; n i int count = 0; count 0 while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            } true {
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            } if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                } n % 2 == 1 n % 2 n 2 1 {
                    break;
                } break; {
                    n /=2;
                    count++;
                } n /=2 n 2 count++ count if(max < count){
                ans = i;
                max = count;
            } max < count max count {
                ans = i;
                max = count;
            } ans = i ans i max = count max count System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int N = Integer.parseInt(sc.next());
        
        int ans = 1;
        int max = 0;
        for(int i=1; i<=N; i++){
            int n = i;
            int count = 0;
            while(true){
                if(n % 2 == 1){
                    break;
                }else{
                    n /=2;
                    count++;
                }
            }
            
            if(max < count){
                ans = i;
                max = count;
            }
        }
        System.out.println(ans);
    }
}