import java.util.Scanner;

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

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