import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans = 1; ans 1 int ansCount = 0; ansCount 0 for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		} {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		} if(i%2 != 0) {
				continue;
			} i%2 != 0 i%2 i 2 0 {
				continue;
			} continue; int tmp = i; tmp i int count = 0; count 0 while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			} true {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			} if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				} tmp%2 == 0 tmp%2 tmp 2 0 {
					count++;
					tmp = tmp/2;
				} count++ count tmp = tmp/2 tmp tmp/2 tmp 2 {
					break;
				} break; if(count > ansCount) {
				ans = i;
				ansCount = count;
			} count > ansCount count ansCount {
				ans = i;
				ansCount = count;
			} ans = i ans i ansCount = count ansCount count System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int ans = 1;
		int ansCount = 0;
		for(int i = 1; i <= N; i++) {
			if(i%2 != 0) {
				continue;
			}
			int tmp = i;
			int count = 0;
			while(true) {
				if(tmp%2 == 0) {
					count++;
					tmp = tmp/2;
				} else {
					break;
				}
			}
			if(count > ansCount) {
				ans = i;
				ansCount = count;
			}
		}
		System.out.println(ans);
	}
}