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

public class Main {

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i));

		int n = cin.nextInt();

		long millis = System.currentTimeMillis();

		int ans = solve(n);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	}

	private static int solve(int n) {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i);
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

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

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i));

		int n = cin.nextInt();

		long millis = System.currentTimeMillis();

		int ans = solve(n);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	}

	private static int solve(int n) {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i);
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

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

} Main public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	} main {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	} ConsoleScanner cin = new ConsoleScanner(); cin new ConsoleScanner() PrintWriter cout = new PrintWriter(System.out); cout new PrintWriter(System.out) solve(cin, cout) solve cin cout cout.flush() cout.flush cout String args[] args private static void solve(ConsoleScanner cin, PrintWriter cout) {
		for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i));

		int n = cin.nextInt();

		long millis = System.currentTimeMillis();

		int ans = solve(n);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	} solve {
		for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i));

		int n = cin.nextInt();

		long millis = System.currentTimeMillis();

		int ans = solve(n);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	} for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i)); int i = 1; int i = 1; i 1 i <= 100 i 100 i++ i++ i assert null != System.out.format("%d %d\n", i, solve(i)); int n = cin.nextInt(); n cin.nextInt() cin.nextInt cin long millis = System.currentTimeMillis(); millis System.currentTimeMillis() System.currentTimeMillis System int ans = solve(n); ans solve(n) solve n cout.println(ans) cout.println cout ans ConsoleScanner cin cin PrintWriter cout cout private static int solve(int n) {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i);
		return ans;
	} solve {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i);
		return ans;
	} int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i); int i = 0; int i = 0; i 0 i < 30 i 30 i++ i++ i if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i); if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i); n >> i != 0 n >> i n i 0 ans = Math.min(ans, (n >> i) << i) ans Math.min(ans, (n >> i) << i) Math.min Math ans (n >> i) << i (n >> i) n i i return ans; ans int n n static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
	} ConsoleScanner BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(""); st new StringTokenizer("") String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		} next {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		} try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			} catch (IOException e) {
				throw new AssertionError(e);
			} IOException e {
				throw new AssertionError(e);
			} throw new AssertionError(e); new AssertionError(e) {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine()); !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st 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[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i));

		int n = cin.nextInt();

		long millis = System.currentTimeMillis();

		int ans = solve(n);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	}

	private static int solve(int n) {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i);
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

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

} public class Main {

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i));

		int n = cin.nextInt();

		long millis = System.currentTimeMillis();

		int ans = solve(n);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	}

	private static int solve(int n) {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i);
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

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

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

public class Main {

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		for (int i = 1; i <= 100; i++)
			assert null != System.out.format("%d %d\n", i, solve(i));

		int n = cin.nextInt();

		long millis = System.currentTimeMillis();

		int ans = solve(n);

		cout.println(ans);
		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	}

	private static int solve(int n) {
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < 30; i++)
			if (n >> i != 0)
				ans = Math.min(ans, (n >> i) << i);
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			try {
				while (!st.hasMoreElements())
					st = new StringTokenizer(br.readLine());
				return st.nextToken();
			} catch (IOException e) {
				throw new AssertionError(e);
			}
		}

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

}
