import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int num = 1;
        for (int i = 1 ; i <= n ; i++) {
            int x = i;
            int count = 0;
            while (x % 2 == 0) {
                count++;
                x /= 2;
            }
            if (count > max) {
                num = i;
                max = count;
            }
        }
        System.out.println(num);
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int num = 1;
        for (int i = 1 ; i <= n ; i++) {
            int x = i;
            int count = 0;
            while (x % 2 == 0) {
                count++;
                x /= 2;
            }
            if (count > max) {
                num = i;
                max = count;
            }
        }
        System.out.println(num);
    }

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

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int num = 1;
        for (int i = 1 ; i <= n ; i++) {
            int x = i;
            int count = 0;
            while (x % 2 == 0) {
                count++;
                x /= 2;
            }
            if (count > max) {
                num = i;
                max = count;
            }
        }
        System.out.println(num);
    }

} public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int num = 1;
        for (int i = 1 ; i <= n ; i++) {
            int x = i;
            int count = 0;
            while (x % 2 == 0) {
                count++;
                x /= 2;
            }
            if (count > max) {
                num = i;
                max = count;
            }
        }
        System.out.println(num);
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int max = 0;
        int num = 1;
        for (int i = 1 ; i <= n ; i++) {
            int x = i;
            int count = 0;
            while (x % 2 == 0) {
                count++;
                x /= 2;
            }
            if (count > max) {
                num = i;
                max = count;
            }
        }
        System.out.println(num);
    }

}