import java.util.*;

class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int x = 0;
	int cout = 0;
	int temp = 0;
	int ans = 1;
	for(int i = 1; i <= n; i++) {
		x = i;
		while(x % 2 == 0) {
			temp++;
			x /= 2;
		}
		if(temp > cout) {
			cout = temp;
			ans = i;
		}
		temp = 0;
	}
	System.out.println(ans);
}
} import java.util.*; util.* java class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int x = 0;
	int cout = 0;
	int temp = 0;
	int ans = 1;
	for(int i = 1; i <= n; i++) {
		x = i;
		while(x % 2 == 0) {
			temp++;
			x /= 2;
		}
		if(temp > cout) {
			cout = temp;
			ans = i;
		}
		temp = 0;
	}
	System.out.println(ans);
}
} Main public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int x = 0;
	int cout = 0;
	int temp = 0;
	int ans = 1;
	for(int i = 1; i <= n; i++) {
		x = i;
		while(x % 2 == 0) {
			temp++;
			x /= 2;
		}
		if(temp > cout) {
			cout = temp;
			ans = i;
		}
		temp = 0;
	}
	System.out.println(ans);
} main {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int x = 0;
	int cout = 0;
	int temp = 0;
	int ans = 1;
	for(int i = 1; i <= n; i++) {
		x = i;
		while(x % 2 == 0) {
			temp++;
			x /= 2;
		}
		if(temp > cout) {
			cout = temp;
			ans = i;
		}
		temp = 0;
	}
	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 x = 0; x 0 int cout = 0; cout 0 int temp = 0; temp 0 int ans = 1; ans 1 for(int i = 1; i <= n; i++) {
		x = i;
		while(x % 2 == 0) {
			temp++;
			x /= 2;
		}
		if(temp > cout) {
			cout = temp;
			ans = i;
		}
		temp = 0;
	} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
		x = i;
		while(x % 2 == 0) {
			temp++;
			x /= 2;
		}
		if(temp > cout) {
			cout = temp;
			ans = i;
		}
		temp = 0;
	} {
		x = i;
		while(x % 2 == 0) {
			temp++;
			x /= 2;
		}
		if(temp > cout) {
			cout = temp;
			ans = i;
		}
		temp = 0;
	} x = i x i while(x % 2 == 0) {
			temp++;
			x /= 2;
		} x % 2 == 0 x % 2 x 2 0 {
			temp++;
			x /= 2;
		} temp++ temp x /= 2 x 2 if(temp > cout) {
			cout = temp;
			ans = i;
		} temp > cout temp cout {
			cout = temp;
			ans = i;
		} cout = temp cout temp ans = i ans i temp = 0 temp 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

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