import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int maxN = 0;
        int maxI = 0;

        for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        }

        System.out.println(maxI);

    }


} 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 maxN = 0;
        int maxI = 0;

        for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        }

        System.out.println(maxI);

    }


} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int maxN = 0;
        int maxI = 0;

        for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        }

        System.out.println(maxI);

    } main {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int maxN = 0;
        int maxI = 0;

        for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        }

        System.out.println(maxI);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int maxN = 0; maxN 0 int maxI = 0; maxI 0 for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        } int i = 0; int i = 0; i 0 i <= N i N i++ i++ i {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        } {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        } int n = 0; n 0 int temp = i; temp i while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            } temp % 2 == 0 && temp != 0 temp % 2 == 0 temp % 2 temp 2 0 temp != 0 temp 0 {
                temp = temp / 2;
                n++;
            } temp = temp / 2 temp temp / 2 temp 2 n++ n if (n >= maxN) {
                maxN = n;
                maxI = i;
            } n >= maxN n maxN {
                maxN = n;
                maxI = i;
            } maxN = n maxN n maxI = i maxI i System.out.println(maxI) System.out.println System.out System System.out maxI String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int maxN = 0;
        int maxI = 0;

        for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        }

        System.out.println(maxI);

    }


} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int maxN = 0;
        int maxI = 0;

        for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        }

        System.out.println(maxI);

    }


} 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 maxN = 0;
        int maxI = 0;

        for (int i = 0; i <= N; i++) {

            int n = 0;
            int temp = i;
            while (temp % 2 == 0 && temp != 0) {
                temp = temp / 2;
                n++;
            }

            if (n >= maxN) {
                maxN = n;
                maxI = i;
            }
        }

        System.out.println(maxI);

    }


}