import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int count = 0;
		int ans = 1;
		for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int count = 0;
		int ans = 1;
		for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int count = 0;
		int ans = 1;
		for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		}
		System.out.println(ans);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int count = 0;
		int ans = 1;
		for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc sc.close() sc.close sc int count = 0; count 0 int ans = 1; ans 1 for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		} int i=1; int i=1; i 1 i<=n i n i++ i++ i {
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		} {
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		} int count1 = 0; count1 0 int tmp = i; tmp i while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			} tmp%2==0 tmp%2 tmp 2 0 {
				tmp = tmp/2;
				count1 = count1+1;
			} tmp = tmp/2 tmp tmp/2 tmp 2 count1 = count1+1 count1 count1+1 count1 1 if(count1>count) {
				count = count1;
				ans = i;
			} count1>count count1 count {
				count = count1;
				ans = i;
			} count = count1 count count1 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int count = 0;
		int ans = 1;
		for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int count = 0;
		int ans = 1;
		for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		int count = 0;
		int ans = 1;
		for(int i=1;i<=n;i++){
			int count1 = 0;
			int tmp = i;
			while(tmp%2==0) {
				tmp = tmp/2;
				count1 = count1+1;
			}
			if(count1>count) {
				count = count1;
				ans = i;
			}
		}
		System.out.println(ans);
	}
}