import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int count = 0;
        int res = 0;
        for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        }

        System.out.println(n == 1 ? 1 : res);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int count = 0;
        int res = 0;
        for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        }

        System.out.println(n == 1 ? 1 : res);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int count = 0;
        int res = 0;
        for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        }

        System.out.println(n == 1 ? 1 : res);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int count = 0;
        int res = 0;
        for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        }

        System.out.println(n == 1 ? 1 : res);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count = 0; count 0 int res = 0; res 0 for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        } {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        } int targetNumber = i; targetNumber i int tmpCount = 0; tmpCount 0 while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            } targetNumber % 2 == 0 targetNumber % 2 targetNumber 2 0 {
                tmpCount++;
                targetNumber /= 2;
            } tmpCount++ tmpCount targetNumber /= 2 targetNumber 2 if (count < tmpCount) {
                res = i;
                count = tmpCount;
            } count < tmpCount count tmpCount {
                res = i;
                count = tmpCount;
            } res = i res i count = tmpCount count tmpCount System.out.println(n == 1 ? 1 : res) System.out.println System.out System System.out n == 1 ? 1 : res n == 1 n 1 1 res String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int count = 0;
        int res = 0;
        for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        }

        System.out.println(n == 1 ? 1 : res);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int count = 0;
        int res = 0;
        for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        }

        System.out.println(n == 1 ? 1 : res);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int count = 0;
        int res = 0;
        for (int i = 1; i <= n; i++) {
            int targetNumber = i;
            int tmpCount = 0;
            while (targetNumber % 2 == 0) {
                tmpCount++;
                targetNumber /= 2;
            }

            if (count < tmpCount) {
                res = i;
                count = tmpCount;
            }
        }

        System.out.println(n == 1 ? 1 : res);
    }
}
