import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        }
    }
} import java.io.IOException; IOException java.io import java.util.NoSuchElementException; NoSuchElementException java.util import java.io.BufferedReader; BufferedReader java.io import java.io.InputStream; InputStream java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        }
    }
} Main public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        }
    } main {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        }
    } try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        } {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) new BufferedReader(
                new InputStreamReader(System.in)) final String s = reader.readLine(); s reader.readLine() reader.readLine reader int N = Integer.parseInt(s); N Integer.parseInt(s) Integer.parseInt Integer s int mx = 0; mx 0 int x = 0; x 0 for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            } {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            } int t = i; t i int c = 0; c 0 while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                } 0 < t 0 t {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                } if ((t & 1) == 1) break; (t & 1) == 1 (t & 1) t 1 1 break; t = t >> 1 t t >> 1 t 1 c++ c if (mx <= c) {
                    mx = c;
                    x = i;
                } mx <= c mx c {
                    mx = c;
                    x = i;
                } mx = c mx c x = i x i System.out.println(x) System.out.println System.out System System.out x String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        }
    }
} Main
import java.io.IOException;
import java.util.NoSuchElementException;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            int N = Integer.parseInt(s);

            int mx = 0;
            int x = 0;
            for (int i = 1; i <= N; i++) {
                int t = i;
                int c = 0;
                while (0 < t) {
                    if ((t & 1) == 1) break;
                    t = t >> 1;
                    c++;
                }
                if (mx <= c) {
                    mx = c;
                    x = i;
                }
            }

            System.out.println(x);
        }
    }
}
