import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int ans = 1;
		int count =0;
		for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int ans = 1;
		int count =0;
		for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int ans = 1;
		int count =0;
		for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int ans = 1;
		int count =0;
		for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int ans = 1; ans 1 int count =0; count 0 for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		} {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		} int divi = i; divi i int roop = 0; roop 0 while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			} divi % 2 == 0 divi % 2 divi 2 0 {
				divi = divi/2;
				roop++;
			} divi = divi/2 divi divi/2 divi 2 roop++ roop if(count < roop) {
				count = roop;
				ans = i;
			} count < roop count roop {
				count = roop;
				ans = i;
			} count = roop count roop ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int ans = 1;
		int count =0;
		for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int ans = 1;
		int count =0;
		for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int ans = 1;
		int count =0;
		for(int i = 1; i <= n; i++) {
			int divi = i;
			int roop = 0;
			while(divi % 2 == 0) {
				divi = divi/2;
				roop++;
			}
			if(count < roop) {
				count = roop;
				ans = i;
			}
		}
		System.out.println(ans);
	}
}