import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        }

        private int getTwoCount(int n) {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.InputStream; InputStream java.io public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        }

        private int getTwoCount(int n) {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out FastReader in = new FastReader(inputStream); in new FastReader(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) TaskB solver = new TaskB(); solver new TaskB() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        }

        private int getTwoCount(int n) {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        }

    } TaskB public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        } solve {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        } int n = in.nextInt(); n in.nextInt() in.nextInt in int ans = 1; ans 1 int ansCount = 0; ansCount 0 for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            } {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            } int count = getTwoCount(i); count getTwoCount(i) getTwoCount i if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                } count > ansCount count ansCount {
                    ans = i;
                    ansCount = count;
                } ans = i ans i ansCount = count ansCount count out.println(ans) out.println out ans int testNumber testNumber FastReader in in PrintWriter out out private int getTwoCount(int n) {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        } getTwoCount {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        } int ret = 0; ret 0 while (n % 2 == 0) {
                ++ret;
                n /= 2;
            } n % 2 == 0 n % 2 n 2 0 {
                ++ret;
                n /= 2;
            } ++ret ret n /= 2 n 2 return ret; ret int n n static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    } FastReader BufferedReader reader; reader StringTokenizer st; st public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        } FastReader {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        } reader = new BufferedReader(new InputStreamReader(stream)) reader new BufferedReader(new InputStreamReader(stream)) st = null st null InputStream stream stream public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        } next {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        } while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            } try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                } catch (Exception e) {
                    throw new RuntimeException();
                } Exception e {
                    throw new RuntimeException();
                } throw new RuntimeException(); new RuntimeException() {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } String line = reader.readLine(); line reader.readLine() reader.readLine reader if (line == null) {
                        return null;
                    } line == null line null {
                        return null;
                    } return null; null st = new StringTokenizer(line) st new StringTokenizer(line) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        }

        private int getTwoCount(int n) {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        }

        private int getTwoCount(int n) {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 1;
            int ansCount = 0;
            for (int i = 1; i <= n; i++) {
                int count = getTwoCount(i);
                if (count > ansCount) {
                    ans = i;
                    ansCount = count;
                }
            }
            out.println(ans);
        }

        private int getTwoCount(int n) {
            int ret = 0;
            while (n % 2 == 0) {
                ++ret;
                n /= 2;
            }
            return ret;
        }

    }

    static class FastReader {
        BufferedReader reader;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

