import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		int ans = 1;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		}

		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 max = 0;
		int ans = 1;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		}

		System.out.println(ans);

		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		int ans = 1;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		}

		System.out.println(ans);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		int max = 0;
		int ans = 1;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		}

		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 max = 0; max 0 int ans = 1; ans 1 for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		} {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		} int x = i; x i int a = 0; a 0 while (x % 2 == 0) {
				x /= 2;
				a++;
			} x % 2 == 0 x % 2 x 2 0 {
				x /= 2;
				a++;
			} x /= 2 x 2 a++ a if (max < a) {
				max = a;
				ans = i;
			} max < a max a {
				max = a;
				ans = i;
			} max = a max a ans = i ans i 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 max = 0;
		int ans = 1;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		}

		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 max = 0;
		int ans = 1;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		}

		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 max = 0;
		int ans = 1;
		for (int i = 1; i <= n; i++) {
			int x = i;
			int a = 0;
			while (x % 2 == 0) {
				x /= 2;
				a++;
			}
			if (max < a) {
				max = a;
				ans = i;
			}
		}

		System.out.println(ans);

		sc.close();
	}

}
