import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; public class Main { static MyPrintWriter pw = MyPrintWriter.getInstance(); static FastScanner sc = FastScanner.getInstance(); public static void main(String[] args) throws IOException { Thread.setDefaultUncaughtExceptionHandler((t, e) -> System.exit(1)); new Main().run(); // new Main().check(); pw.flush(); } void run() { long N = sc.nextLong(); var pos = Longs.bitPositions(N); // 2^m-1個ある // 2^{m-1} long ans = 1L << pos[pos.length - 1]; pw.println(ans); } } class FastScanner { private static FastScanner instance = null; private final InputStream in = System.in; private final byte[] buffer = new byte[1 << 16]; private int ptr = 0; private int buflen = 0; private FastScanner() { } public static FastScanner getInstance() { if (instance == null) { instance = new FastScanner(); } return instance; } private boolean hasNextByte() { if (ptr < buflen) { return true; } ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } return buflen > 0; } private int readByte() { if (hasNextByte()) { return buffer[ptr++]; } else { return -1; } } private boolean isPrintableChar(int c) { return (33 <= c) && (c <= 126); } public boolean hasNext() { while (hasNextByte() && (!isPrintableChar(buffer[ptr]))) { ptr++; } return hasNextByte(); } public long nextLong() { if (!hasNext()) { throw new NoSuchElementException(); } long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } while ((b >= '0') && (b <= '9')) { // n = n * 10 + (b - '0'); n = ((n << 1) + (n << 3)) + (b - '0'); b = readByte(); } return minus ? -n : n; } } class Longs { /** * 負数の63bit目(0-origin)は1とする。 * * @param binary * @param pos * @return */ public static int bitAt(long binary, int pos) { if (pos >= 64) { return 0; } return ((int) ((binary >>> pos) % 2)); } /** * bitが立っている位置を昇順に並べた配列を返す。 * * @param a * @return */ public static int[] bitPositions(long a) { int pointer = 0; int[] ret = new int[Long.bitCount(a)]; for (int i = 0; i < 64; ++i) { if (Longs.bitAt(a, i) == 1) { ret[pointer++] = i; } } return ret; } } class MyPrintWriter extends PrintWriter { private static MyPrintWriter instance = null; private MyPrintWriter() { super(System.out); } public static MyPrintWriter getInstance() { if (instance == null) { instance = new MyPrintWriter(); } return instance; } } // --- Original Code --- // // // import java.io.IOException; // import java.util.Arrays; // import java.util.HashSet; // import java.util.Set; // // import library.tools.FastScanner; // import library.tools.MergeFiles; // import library.tools.MyPrintWriter; // import library.util.Longs; // import library.util.collections.ImplicitTreap; // import library.util.collections.IntTreapMultiSet; // import library.util.collections.LongTreapMultiSet; // // public class Main { // static MyPrintWriter pw = MyPrintWriter.getInstance(); // static FastScanner sc = FastScanner.getInstance(); // // public static void main(String[] args) throws IOException { // new Main().run(); // // new Main().check(); // pw.flush(); // MergeFiles.export(); // } // // void run() { // long N=sc.nextLong(); // var pos=Longs.bitPositions(N); // //2^m-1個ある // //2^{m-1} // long ans=1L<