import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int maxcount = 0;
		int ans = 1;
		for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		}
		System.out.println(ans);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int maxcount = 0;
		int ans = 1;
		for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		}
		System.out.println(ans);

	}

} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int maxcount = 0;
		int ans = 1;
		for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		}
		System.out.println(ans);

	} main {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int maxcount = 0;
		int ans = 1;
		for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		}
		System.out.println(ans);

	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N = stdIn.nextInt(); N stdIn.nextInt() stdIn.nextInt stdIn int maxcount = 0; maxcount 0 int ans = 1; ans 1 for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		} {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		} int a = i; a i int count = 0; count 0 while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			} a%2 == 0 && i >= 1 a%2 == 0 a%2 a 2 0 i >= 1 i 1 {
				a /= 2;
				count++;
			} a /= 2 a 2 count++ count if(count > maxcount) {
				maxcount = count;
				ans = i;
			} count > maxcount count maxcount {
				maxcount = count;
				ans = i;
			} maxcount = count maxcount count 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 stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int maxcount = 0;
		int ans = 1;
		for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		}
		System.out.println(ans);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int maxcount = 0;
		int ans = 1;
		for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		}
		System.out.println(ans);

	}

} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		int maxcount = 0;
		int ans = 1;
		for(int i = 1; i <= N; i++) {
			int a = i;
			int count = 0;
			while(a%2 == 0 && i >= 1) {
				a /= 2;
				count++;
			}
			if(count > maxcount) {
				maxcount = count;
				ans = i;
			}
		}
		System.out.println(ans);

	}

}