import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskB {
        public static int div(int n) {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        }

        public void solve(int testNumber, Scanner sn, PrintWriter out) {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        }

    }
}
 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.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public static int div(int n) {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        }

        public void solve(int testNumber, Scanner sn, PrintWriter out) {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(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;
        Scanner in = new Scanner(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 Scanner in = new Scanner(inputStream); in new Scanner(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 static int div(int n) {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        }

        public void solve(int testNumber, Scanner sn, PrintWriter out) {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        }

    } TaskB public static int div(int n) {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        } div {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        } int res = 0; res 0 while (n % 2 == 0) {
                res++;
                n = n / 2;
            } n % 2 == 0 n % 2 n 2 0 {
                res++;
                n = n / 2;
            } res++ res n = n / 2 n n / 2 n 2 return res; res int n n public void solve(int testNumber, Scanner sn, PrintWriter out) {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        } solve {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        } int n = sn.nextInt(); n sn.nextInt() sn.nextInt sn int res = 0; res 0 int m = 1; m 1 int i = 2; i 2 for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            } ; i <= n i n i++ i++ i {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            } {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            } if (res < div(i)) {
                    res = div(i);
                    m = i;
                } res < div(i) res div(i) div i {
                    res = div(i);
                    m = i;
                } res = div(i) res div(i) div i m = i m i out.println(m) out.println out m int testNumber testNumber Scanner sn sn PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public static int div(int n) {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        }

        public void solve(int testNumber, Scanner sn, PrintWriter out) {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        }

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

    static class TaskB {
        public static int div(int n) {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        }

        public void solve(int testNumber, Scanner sn, PrintWriter out) {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskB {
        public static int div(int n) {
            int res = 0;
            while (n % 2 == 0) {
                res++;
                n = n / 2;
            }
            return res;

        }

        public void solve(int testNumber, Scanner sn, PrintWriter out) {
            int n = sn.nextInt();
            int res = 0;
            int m = 1;
            int i = 2;
            for (; i <= n; i++) {
                if (res < div(i)) {
                    res = div(i);
                    m = i;
                }
            }
            out.println(m);
        }

    }
}

