import java.util.Scanner;
public class Main {
	public static int N,K,a=-1;
	public static String ans="";
	//public static int a[][]=new int[5][5];

	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static int N,K,a=-1;
	public static String ans="";
	//public static int a[][]=new int[5][5];

	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		}
		System.out.println(ans);
	}
} Main public static int N N K K a=-1; a -1 1 public static String ans=""; ans "" public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		}
		System.out.println(ans);
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) N=sc.nextInt() N sc.nextInt() sc.nextInt sc for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		} int i=1; int i=1; i 1 i<=N i N i++ i++ i {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		} {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		} int get=0; get 0 int tri=i; tri i for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			} ; {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			} {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			} if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				} tri%2==0 tri%2 tri 2 0 {
					tri/=2;
					get++;
				} tri/=2 tri 2 get++ get {
					break;
				} break; if(a<get) {
				a=get;
				ans=""+i;
			} a<get a get {
				a=get;
				ans=""+i;
			} a=get a get ans=""+i ans ""+i "" i System.out.println(ans) System.out.println System.out System System.out ans String[]args args public class Main {
	public static int N,K,a=-1;
	public static String ans="";
	//public static int a[][]=new int[5][5];

	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static int N,K,a=-1;
	public static String ans="";
	//public static int a[][]=new int[5][5];

	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;
public class Main {
	public static int N,K,a=-1;
	public static String ans="";
	//public static int a[][]=new int[5][5];

	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
		N=sc.nextInt();
		for(int i=1;i<=N;i++) {
			int get=0;int tri=i;
			for(;;) {
				if(tri%2==0) {
					tri/=2;
					get++;
				}else {
					break;
				}
			}
			if(a<get) {
				a=get;
				ans=""+i;
			}
		}
		System.out.println(ans);
	}
}