import static java.lang.System.*;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(in);
		
		int n = s.nextInt();
		
		int cur = 1;
		int max = 0;
		
		for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		}
		
		out.println(cur);
	}
} import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(in);
		
		int n = s.nextInt();
		
		int cur = 1;
		int max = 0;
		
		for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		}
		
		out.println(cur);
	}
} Main public static void main(String[] args) {
		Scanner s = new Scanner(in);
		
		int n = s.nextInt();
		
		int cur = 1;
		int max = 0;
		
		for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		}
		
		out.println(cur);
	} main {
		Scanner s = new Scanner(in);
		
		int n = s.nextInt();
		
		int cur = 1;
		int max = 0;
		
		for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		}
		
		out.println(cur);
	} Scanner s = new Scanner(in); s new Scanner(in) int n = s.nextInt(); n s.nextInt() s.nextInt s int cur = 1; cur 1 int max = 0; max 0 for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		} int x=2; int x=2; x 2 x<=n x n x++ x++ x {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		} {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		} int exp = 1; exp 1 while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++; x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x x%Math.pow(2,exp)==0 x%Math.pow(2,exp) x Math.pow(2,exp) Math.pow Math 2 exp 0 Math.pow(2,exp)<x Math.pow(2,exp) Math.pow Math 2 exp x exp++ exp if(exp>max) {
				max = exp;
				cur = x;
			} exp>max exp max {
				max = exp;
				cur = x;
			} max = exp max exp cur = x cur x out.println(cur) out.println out cur String[] args args public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(in);
		
		int n = s.nextInt();
		
		int cur = 1;
		int max = 0;
		
		for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		}
		
		out.println(cur);
	}
} public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(in);
		
		int n = s.nextInt();
		
		int cur = 1;
		int max = 0;
		
		for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		}
		
		out.println(cur);
	}
} Main
import static java.lang.System.*;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner s = new Scanner(in);
		
		int n = s.nextInt();
		
		int cur = 1;
		int max = 0;
		
		for(int x=2;x<=n;x++) {
			int exp = 1;
			while(x%Math.pow(2,exp)==0 && Math.pow(2,exp)<x)
				exp++;
			
			if(exp>max) {
				max = exp;
				cur = x;
			}
		}
		
		out.println(cur);
	}
}