import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Max = 1, MaxValue = 0;
		int count = 0;
		

		for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		}
		System.out.println(Max);
	}

} import java.util.Scanner; Scanner java.util public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Max = 1, MaxValue = 0;
		int count = 0;
		

		for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		}
		System.out.println(Max);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Max = 1, MaxValue = 0;
		int count = 0;
		

		for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		}
		System.out.println(Max);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Max = 1, MaxValue = 0;
		int count = 0;
		

		for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		}
		System.out.println(Max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int Max = 1 Max 1 MaxValue = 0; MaxValue 0 int count = 0; count 0 for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		} {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		} int tempI = i; tempI i while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			} true {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			} if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				} tempI % 2 == 0 tempI % 2 tempI 2 0 {
					++count;
					tempI /= 2;
				} ++count count tempI /= 2 tempI 2 {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				} if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					} MaxValue < count MaxValue count {
						Max = i;
						MaxValue = count;
						
					} Max = i Max i MaxValue = count MaxValue count break; count = 0 count 0 System.out.println(Max) System.out.println System.out System System.out Max String[] args args public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Max = 1, MaxValue = 0;
		int count = 0;
		

		for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		}
		System.out.println(Max);
	}

} public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Max = 1, MaxValue = 0;
		int count = 0;
		

		for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		}
		System.out.println(Max);
	}

} Main
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Max = 1, MaxValue = 0;
		int count = 0;
		

		for (int i = 1; i <= N; i++) {
			int tempI = i;

			while(true) {
				if (tempI % 2 == 0) {
					++count;
					tempI /= 2;
				}
				else {
					if(MaxValue < count) {
						Max = i;
						MaxValue = count;
						
					}
					break;
				}
			}
			count = 0;

		}
		System.out.println(Max);
	}

}
