import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int ansc=0;
	for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	}
	System.out.println(a==1?1:ans);
}
} import java.util.Scanner; Scanner java.util public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int ansc=0;
	for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	}
	System.out.println(a==1?1:ans);
}
} Main public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int ansc=0;
	for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	}
	System.out.println(a==1?1:ans);
} main {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int ansc=0;
	for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	}
	System.out.println(a==1?1:ans);
} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int a=scan.nextInt(); a scan.nextInt() scan.nextInt scan int ans=0; ans 0 int ansc=0; ansc 0 for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	} int i=1; int i=1; i 1 i!=a+1 i a+1 a 1 i++ i++ i {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	} {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	} int count=0; count 0 for(int j=i;j%2==0;count++,j/=2) {} int j=i; int j=i; j i j%2==0 j%2 j 2 0 count++,j/=2 count++ count j/=2 j 2 {} {} if(ansc<count) {
				ans=i;
				ansc=count;
			} ansc<count ansc count {
				ans=i;
				ansc=count;
			} ans=i ans i ansc=count ansc count System.out.println(a==1?1:ans) System.out.println System.out System System.out a==1?1:ans a==1 a 1 1 ans String[]srgs srgs public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int ansc=0;
	for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	}
	System.out.println(a==1?1:ans);
}
} public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int ansc=0;
	for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	}
	System.out.println(a==1?1:ans);
}
} Main
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int ans=0;
	int ansc=0;
	for(int i=1;i!=a+1;i++) {
		int count=0;
		for(int j=i;j%2==0;count++,j/=2) {}
			if(ansc<count) {
				ans=i;
				ansc=count;
			}
	}
	System.out.println(a==1?1:ans);
}
}