import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int soeji = 1;
        int max = 0;
        for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        }
        System.out.println(soeji);
    }
} 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 soeji = 1;
        int max = 0;
        for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        }
        System.out.println(soeji);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int soeji = 1;
        int max = 0;
        for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        }
        System.out.println(soeji);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int soeji = 1;
        int max = 0;
        for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        }
        System.out.println(soeji);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int soeji = 1; soeji 1 int max = 0; max 0 for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        } int i=1; int i=1; i 1 i<=N i N i++ i++ i {
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        } {
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        } int x = i; x i int count=0; count 0 while(x % 2 == 0){
                count++;
                x = x / 2;
            } x % 2 == 0 x % 2 x 2 0 {
                count++;
                x = x / 2;
            } count++ count x = x / 2 x x / 2 x 2 if(count > max){
                max = count;
                soeji = i;
            } count > max count max {
                max = count;
                soeji = i;
            } max = count max count soeji = i soeji i System.out.println(soeji) System.out.println System.out System System.out soeji String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int soeji = 1;
        int max = 0;
        for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        }
        System.out.println(soeji);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int soeji = 1;
        int max = 0;
        for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        }
        System.out.println(soeji);
    }
} 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 soeji = 1;
        int max = 0;
        for(int i=1;i<=N;i++){
            int x = i;
            int count=0;
            while(x % 2 == 0){
                count++;
                x = x / 2;
            }
            if(count > max){
                max = count;
                soeji = i;
            }
        }
        System.out.println(soeji);
    }
}
