import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/
//int i = Integer.parseInt(s);
//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		int maxCtn=0;
		int maxAns=1;
		int ctn=0;
		for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		}
		p(maxAns);
	}
} import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Queue; Queue java.util import java.util.Scanner; Scanner java.util public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		int maxCtn=0;
		int maxAns=1;
		int ctn=0;
		for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		}
		p(maxAns);
	}
} Main static int a1[]= {0,-1,0,1}; a1 {0,-1,0,1} 0 -1 1 0 1 static int b1[]= {-1,0,1,0}; b1 {-1,0,1,0} -1 1 0 1 0 private static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static int K; K static void p(String ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans String ans ans static void p(int ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans int ans ans static void p(long ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans long ans ans static void p(double ans) {System.out.println(ans);} p {System.out.println(ans);} System.out.println(ans) System.out.println System.out System System.out ans double ans ans public static void main(String[] args) {
		int N=sc.nextInt();
		int maxCtn=0;
		int maxAns=1;
		int ctn=0;
		for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		}
		p(maxAns);
	} main {
		int N=sc.nextInt();
		int maxCtn=0;
		int maxAns=1;
		int ctn=0;
		for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		}
		p(maxAns);
	} int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int maxCtn=0; maxCtn 0 int maxAns=1; maxAns 1 int ctn=0; ctn 0 for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		} int i=1; int i=1; i 1 i<=N i N i++ i++ i {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		} {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		} int v=i; v i while(v%2!=1) {
				v=v/2;
				ctn++;
			} v%2!=1 v%2 v 2 1 {
				v=v/2;
				ctn++;
			} v=v/2 v v/2 v 2 ctn++ ctn if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			} maxCtn<ctn maxCtn ctn {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			} maxCtn=ctn maxCtn ctn maxAns=i maxAns i ctn=0 ctn 0 p(maxAns) p maxAns String[] args args public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		int maxCtn=0;
		int maxAns=1;
		int ctn=0;
		for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		}
		p(maxAns);
	}
} public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		int maxCtn=0;
		int maxAns=1;
		int ctn=0;
		for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		}
		p(maxAns);
	}
} Main
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)

//Map<String, Integer> map = new HashMap<String, Integer>(n);
/*for ( キーのデータ型 key : マップの名前.keySet() ) {
	データのデータ型 data = マップの名前.get( key );
	
	// keyやdataを使った処理;
}*/
//int i = Integer.parseInt(s);
//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")
//list.set(1,"walk");
public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static int K;
	public static void main(String[] args) {
		int N=sc.nextInt();
		int maxCtn=0;
		int maxAns=1;
		int ctn=0;
		for(int i=1;i<=N;i++) {

			int v=i;
			while(v%2!=1) {
				v=v/2;
				ctn++;
			}
			if(maxCtn<ctn) {
			//	p("ctn"+ctn+"i"+i);
			//	p("a");
				maxCtn=ctn;
				maxAns=i;
			}
			ctn=0;
		}
		p(maxAns);
	}
}
