import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		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 a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		sc.close();
	} main {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		sc.close();
	} Scanner sc = new Scanner((System.in)); sc new Scanner((System.in)) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int a = 0 a 0 b = 0 b 0 c = 1; c 1 for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		} {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		} int k = i; k i while (k % 2 == 0) {
				k = k / 2;
				a++;
			} k % 2 == 0 k % 2 k 2 0 {
				k = k / 2;
				a++;
			} k = k / 2 k k / 2 k 2 a++ a if (b < a) {
				b = a;
				c = i;
			} b < a b a {
				b = a;
				c = i;
			} b = a b a c = i c i a = 0 a 0 System.out.print(c) System.out.print System.out System System.out c 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 a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int N = sc.nextInt();
		int a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		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 a = 0, b = 0, c = 1;

		for (int i = 1; i <= N; i++) {
			int k = i;
			while (k % 2 == 0) {
				k = k / 2;
				a++;
			}
			if (b < a) {
				b = a;
				c = i;
			}
			a = 0;
		}
		System.out.print(c);
		sc.close();
	}
}
