import java.util.Scanner;

class Main{



	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int ans = 0;
		int numans = 0;

		for(int i = 1;i <= N;i++){
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		}

		System.out.println(numans);


	}

	static int counttwo(int num){					//2で割れる回数をカウント
		int count = 0;
		while(num % 2 == 0){
			count++;
			num /= 2;

		}
		return count;
	}

}

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



	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int ans = 0;
		int numans = 0;

		for(int i = 1;i <= N;i++){
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		}

		System.out.println(numans);


	}

	static int counttwo(int num){					//2で割れる回数をカウント
		int count = 0;
		while(num % 2 == 0){
			count++;
			num /= 2;

		}
		return count;
	}

} Main public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int ans = 0;
		int numans = 0;

		for(int i = 1;i <= N;i++){
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		}

		System.out.println(numans);


	} main {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int ans = 0;
		int numans = 0;

		for(int i = 1;i <= N;i++){
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		}

		System.out.println(numans);


	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans = 0; ans 0 int numans = 0; numans 0 for(int i = 1;i <= N;i++){
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		} {
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		} int sum = counttwo(i); sum counttwo(i) counttwo i ans = Math.max(ans, sum) ans Math.max(ans, sum) Math.max Math ans sum if(sum == ans){
				numans = i;
			} sum == ans sum ans {
				numans = i;
			} numans = i numans i System.out.println(numans) System.out.println System.out System System.out numans String[] args args static int counttwo(int num){					//2で割れる回数をカウント
		int count = 0;
		while(num % 2 == 0){
			count++;
			num /= 2;

		}
		return count;
	} counttwo {					//2で割れる回数をカウント
		int count = 0;
		while(num % 2 == 0){
			count++;
			num /= 2;

		}
		return count;
	} int count = 0; count 0 while(num % 2 == 0){
			count++;
			num /= 2;

		} num % 2 == 0 num % 2 num 2 0 {
			count++;
			num /= 2;

		} count++ count num /= 2 num 2 return count; count int num num
import java.util.Scanner;

class Main{



	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int ans = 0;
		int numans = 0;

		for(int i = 1;i <= N;i++){
			int sum = counttwo(i);
			ans = Math.max(ans, sum);
			if(sum == ans){
				numans = i;
			}

		}

		System.out.println(numans);


	}

	static int counttwo(int num){					//2で割れる回数をカウント
		int count = 0;
		while(num % 2 == 0){
			count++;
			num /= 2;

		}
		return count;
	}

}


