import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxNum = 1;
		int count = 0;
		for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		}
		System.out.println(maxNum);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxNum = 1;
		int count = 0;
		for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		}
		System.out.println(maxNum);
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxNum = 1;
		int count = 0;
		for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		}
		System.out.println(maxNum);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxNum = 1;
		int count = 0;
		for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		}
		System.out.println(maxNum);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int maxNum = 1; maxNum 1 int count = 0; count 0 for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		} {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		} int targetNum = i + 1; targetNum i + 1 i 1 int tmpCount = 0; tmpCount 0 while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			} targetNum % 2 == 0 targetNum % 2 targetNum 2 0 {
				targetNum = targetNum / 2;
				tmpCount++;
			} targetNum = targetNum / 2 targetNum targetNum / 2 targetNum 2 tmpCount++ tmpCount if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			} tmpCount > count tmpCount count {
				count = tmpCount;
				maxNum = i + 1;
			} count = tmpCount count tmpCount maxNum = i + 1 maxNum i + 1 i 1 System.out.println(maxNum) System.out.println System.out System System.out maxNum sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxNum = 1;
		int count = 0;
		for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		}
		System.out.println(maxNum);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxNum = 1;
		int count = 0;
		for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		}
		System.out.println(maxNum);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int maxNum = 1;
		int count = 0;
		for (int i = 0; i < N; i++) {
			int targetNum = i + 1;
			int tmpCount = 0;
			while (targetNum % 2 == 0) {
				targetNum = targetNum / 2;
				tmpCount++;
			}
			if (tmpCount > count) {
				count = tmpCount;
				maxNum = i + 1;
			}
		}
		System.out.println(maxNum);
		sc.close();
	}
}