import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.close();
		int max = 1;
		int max1 = 1;
		for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		}
		System.out.println(max);
		
	}
	public static int calc(int n) {
		if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0;
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.close();
		int max = 1;
		int max1 = 1;
		for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		}
		System.out.println(max);
		
	}
	public static int calc(int n) {
		if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0;
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.close();
		int max = 1;
		int max1 = 1;
		for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		}
		System.out.println(max);
		
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.close();
		int max = 1;
		int max1 = 1;
		for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		}
		System.out.println(max);
		
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in in.close() in.close in int max = 1; max 1 int max1 = 1; max1 1 for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		} int i = n; int i = n; i n i > 1 i 1 i-- i-- i {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		} {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		} int n_i = calc(i); n_i calc(i) calc i if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			} max1 <= n_i max1 n_i { 
				max = i;
				max1 = n_i;
			} max = i max i max1 = n_i max1 n_i System.out.println(max) System.out.println System.out System System.out max String[] args args public static int calc(int n) {
		if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0;
	} calc {
		if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0;
	} if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0; n % 2 == 0 n % 2 n 2 0 return 1 + calc(n / 2); 1 + calc(n / 2) 1 calc(n / 2) calc n / 2 n 2 return 0; 0 int n n public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.close();
		int max = 1;
		int max1 = 1;
		for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		}
		System.out.println(max);
		
	}
	public static int calc(int n) {
		if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0;
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.close();
		int max = 1;
		int max1 = 1;
		for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		}
		System.out.println(max);
		
	}
	public static int calc(int n) {
		if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0;
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.close();
		int max = 1;
		int max1 = 1;
		for (int i = n; i > 1; i-- ) {
			int n_i = calc(i);
			if (max1 <= n_i) { 
				max = i;
				max1 = n_i;
			}
		}
		System.out.println(max);
		
	}
	public static int calc(int n) {
		if (n % 2 == 0) return 1 + calc(n / 2);
		else return 0;
	}
}