import java.util.Scanner;

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