import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		System.out.println(search(N));
	}

	public static int search(int N) {
		int work_n;
		int ans = 1;
		int count = 0;
		int max_count = 0;

		for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		}
		return ans;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		System.out.println(search(N));
	}

	public static int search(int N) {
		int work_n;
		int ans = 1;
		int count = 0;
		int max_count = 0;

		for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		}
		return ans;
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		System.out.println(search(N));
	} main {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		System.out.println(search(N));
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan System.out.println(search(N)) System.out.println System.out System System.out search(N) search N String[] args args public static int search(int N) {
		int work_n;
		int ans = 1;
		int count = 0;
		int max_count = 0;

		for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		}
		return ans;
	} search {
		int work_n;
		int ans = 1;
		int count = 0;
		int max_count = 0;

		for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		}
		return ans;
	} int work_n; work_n int ans = 1; ans 1 int count = 0; count 0 int max_count = 0; max_count 0 for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		} int n = 1; int n = 1; n 1 n <= N n N n++ n++ n {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		} {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		} count = 0 count 0 work_n = n work_n n while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			} (work_n % 2 == 0) && (work_n > 0) (work_n % 2 == 0) work_n % 2 work_n 2 0 (work_n > 0) work_n 0 {
				work_n /= 2;
				count++;
			} work_n /= 2 work_n 2 count++ count if (max_count < count) {
				ans = n;
				max_count = count;
			} max_count < count max_count count {
				ans = n;
				max_count = count;
			} ans = n ans n max_count = count max_count count return ans; ans int N N public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		System.out.println(search(N));
	}

	public static int search(int N) {
		int work_n;
		int ans = 1;
		int count = 0;
		int max_count = 0;

		for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		}
		return ans;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		System.out.println(search(N));
	}

	public static int search(int N) {
		int work_n;
		int ans = 1;
		int count = 0;
		int max_count = 0;

		for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		}
		return ans;
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		System.out.println(search(N));
	}

	public static int search(int N) {
		int work_n;
		int ans = 1;
		int count = 0;
		int max_count = 0;

		for(int n = 1; n <= N; n++) {
			count = 0;
			work_n = n;
			while ((work_n % 2 == 0) && (work_n > 0)) {
				work_n /= 2;
				count++;
			}
			if (max_count < count) {
				ans = n;
				max_count = count;
			}
		}
		return ans;
	}
}
