import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int ans = 1;
		int max = 0;
		for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int ans = 1;
		int max = 0;
		for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int n = sc.nextInt();
		int ans = 1;
		int max = 0;
		for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		}
		System.out.println(ans);
	} main {
		int n = sc.nextInt();
		int ans = 1;
		int max = 0;
		for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		}
		System.out.println(ans);
	} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 1; ans 1 int max = 0; max 0 for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		} int i = 2; int i = 2; i 2 i <= n i n i++ i++ i {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		} {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		} int tmp = i; tmp i int tmpCount = 0; tmpCount 0 while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			} tmp % 2 == 0 tmp % 2 tmp 2 0 {
				tmp /= 2;
				tmpCount++;
			} tmp /= 2 tmp 2 tmpCount++ tmpCount if(max < tmpCount){
				max = tmpCount;
				ans = i;
			} max < tmpCount max tmpCount {
				max = tmpCount;
				ans = i;
			} max = tmpCount max tmpCount ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int ans = 1;
		int max = 0;
		for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int ans = 1;
		int max = 0;
		for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int ans = 1;
		int max = 0;
		for (int i = 2; i <= n; i++) {
			int tmp = i;
			int tmpCount = 0;
			while (tmp % 2 == 0) {
				tmp /= 2;
				tmpCount++;
			}
			if(max < tmpCount){
				max = tmpCount;
				ans = i;
			}
		}
		System.out.println(ans);
	}
}