import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = Integer.parseInt(sc.nextLine()); num Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int max = 0; max 0 int max_let = 0; max_let 0 int ans = 1; ans 1 for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		} int i = 1; int i = 1; i 1 i <= num i num i++ i++ i {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		} {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		} int target = i; target i max_let = 0 max_let 0 while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			} true {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			} if (target % 2 > 0) {
					break;
				} target % 2 > 0 target % 2 target 2 0 {
					break;
				} break; target = target / 2 target target / 2 target 2 max_let++ max_let if (max < max_let) {
				max = max_let;
				ans = i;
			} max < max_let max max_let {
				max = max_let;
				ans = i;
			} max = max_let max max_let ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = Integer.parseInt(sc.nextLine());
		int max = 0;
		int max_let = 0;
		int ans = 1;
		for (int i = 1; i <= num; i++) {
			int target = i;
			max_let = 0;
			while(true) {
				if (target % 2 > 0) {
					break;
				}
				target = target / 2;
				max_let++;
			}
			if (max < max_let) {
				max = max_let;
				ans = i;
			}
		}
		System.out.println(ans);
	}
}
