import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		int max = 0;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		}
		
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		int max = 0;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		}
		
		System.out.println(ans);
	}
} Main @SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		int max = 0;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		}
		
		System.out.println(ans);
	} main {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		int max = 0;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		}
		
		System.out.println(ans);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int max = 0; max 0 int ans = 0; ans 0 for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		} {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		} int count = 0; count 0 for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			} int j = i; int j = i; j i j % 2 == 0 j % 2 j 2 0 j /= 2 j /= 2 j 2 {
				count++;
			} {
				count++;
			} count++ count if (max <= count) {
				max = count;
				ans = i;
			} max <= count max count {
				max = count;
				ans = i;
			} max = count max count ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		int max = 0;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		}
		
		System.out.println(ans);
	}
} public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		int max = 0;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		}
		
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();

		int max = 0;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			for (int j = i; j % 2 == 0; j /= 2) {
				count++;
			}
			if (max <= count) {
				max = count;
				ans = i;
			}
		}
		
		System.out.println(ans);
	}
}
