import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        int maxCount = 0;
        int result = 1;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        }
        
        System.out.println(result);
        
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {

        int maxCount = 0;
        int result = 1;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        }
        
        System.out.println(result);
        
        sc.close();
    }
} Main public static void main(String[] args) throws Exception {

        int maxCount = 0;
        int result = 1;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        }
        
        System.out.println(result);
        
        sc.close();
    } main {

        int maxCount = 0;
        int result = 1;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        }
        
        System.out.println(result);
        
        sc.close();
    } int maxCount = 0; maxCount 0 int result = 1; result 1 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            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 currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        } {
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        } int count = 0; count 0 int currentNum = i; currentNum i while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            } true {
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            } if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                } currentNum % 2 == 0 currentNum % 2 currentNum 2 0 {
                    currentNum = currentNum / 2;
                    count++;
                } currentNum = currentNum / 2 currentNum currentNum / 2 currentNum 2 count++ count {
                    break;
                } break; 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 sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args) throws Exception {

        int maxCount = 0;
        int result = 1;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        }
        
        System.out.println(result);
        
        sc.close();
    }
} public class Main {
    public static void main(String[] args) throws Exception {

        int maxCount = 0;
        int result = 1;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        }
        
        System.out.println(result);
        
        sc.close();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        int maxCount = 0;
        int result = 1;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        for (int i = 1;i <= n; i++){
            int count = 0;
            int currentNum = i;
            
            while(true){
                if (currentNum % 2 == 0) {
                    currentNum = currentNum / 2;
                    count++;
                } else {
                    break;
                }
                
            }

            if (count > maxCount) {
                maxCount = count;
                result = i;
            }
        }
        
        System.out.println(result);
        
        sc.close();
    }
}