import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		}
	}

	private static int returnEvenCnt(int n, int evenCnt) {
		if (n % 2 == 1){
			return evenCnt;
		}
		n /= 2;
		evenCnt++;
		return returnEvenCnt(n, evenCnt);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		}
	}

	private static int returnEvenCnt(int n, int evenCnt) {
		if (n % 2 == 1){
			return evenCnt;
		}
		n /= 2;
		evenCnt++;
		return returnEvenCnt(n, evenCnt);
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		} {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int maxValue = 0; maxValue 0 int maxIndex = 0; maxIndex 0 for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			} {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			} int ans = returnEvenCnt(i, 0); ans returnEvenCnt(i, 0) returnEvenCnt i 0 if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				} maxValue <= ans maxValue ans {
					maxIndex = i;
					maxValue = ans;
				} maxIndex = i maxIndex i maxValue = ans maxValue ans System.out.println(maxIndex) System.out.println System.out System System.out maxIndex String[] args args private static int returnEvenCnt(int n, int evenCnt) {
		if (n % 2 == 1){
			return evenCnt;
		}
		n /= 2;
		evenCnt++;
		return returnEvenCnt(n, evenCnt);
	} returnEvenCnt {
		if (n % 2 == 1){
			return evenCnt;
		}
		n /= 2;
		evenCnt++;
		return returnEvenCnt(n, evenCnt);
	} if (n % 2 == 1){
			return evenCnt;
		} n % 2 == 1 n % 2 n 2 1 {
			return evenCnt;
		} return evenCnt; evenCnt n /= 2 n 2 evenCnt++ evenCnt return returnEvenCnt(n, evenCnt); returnEvenCnt(n, evenCnt) returnEvenCnt n evenCnt int n n int evenCnt evenCnt public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		}
	}

	private static int returnEvenCnt(int n, int evenCnt) {
		if (n % 2 == 1){
			return evenCnt;
		}
		n /= 2;
		evenCnt++;
		return returnEvenCnt(n, evenCnt);
	}
} public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		}
	}

	private static int returnEvenCnt(int n, int evenCnt) {
		if (n % 2 == 1){
			return evenCnt;
		}
		n /= 2;
		evenCnt++;
		return returnEvenCnt(n, evenCnt);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int maxValue = 0;
			int maxIndex = 0;
			for (int i = 1; i <= N;i++) {
				int ans = returnEvenCnt(i, 0);
				if (maxValue <= ans) {
					maxIndex = i;
					maxValue = ans;
				}
			}
			System.out.println(maxIndex);
		}
	}

	private static int returnEvenCnt(int n, int evenCnt) {
		if (n % 2 == 1){
			return evenCnt;
		}
		n /= 2;
		evenCnt++;
		return returnEvenCnt(n, evenCnt);
	}
}