import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int num = 0;
		int max = 0;
		
		for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		}
		System.out.println(max);
	}
} 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 num = 0;
		int max = 0;
		
		for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		}
		System.out.println(max);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int num = 0;
		int max = 0;
		
		for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		}
		System.out.println(max);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int num = 0;
		int max = 0;
		
		for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		}
		System.out.println(max);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int num = 0; num 0 int max = 0; max 0 for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		} {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		} int count = 0; count 0 int x = i; x i while(x % 2 == 0) {
				count++;
				x /= 2;
			} x % 2 == 0 x % 2 x 2 0 {
				count++;
				x /= 2;
			} count++ count x /= 2 x 2 if(num <= count) {
				max = i;
				num = count;
			} num <= count num count {
				max = i;
				num = count;
			} max = i max i num = count num count System.out.println(max) System.out.println System.out System System.out max String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int num = 0;
		int max = 0;
		
		for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		}
		System.out.println(max);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int num = 0;
		int max = 0;
		
		for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		}
		System.out.println(max);
	}
} 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 num = 0;
		int max = 0;
		
		for(int i = 1; i <= N; i++) {
			int count = 0;
			int x = i;
			while(x % 2 == 0) {
				count++;
				x /= 2;
			}
			if(num <= count) {
				max = i;
				num = count;
			}
		}
		System.out.println(max);
	}
}
