
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		}
	}

} 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();
		for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		} ; n > 0 n 0 n-- n-- n {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		} {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		} if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			} (n & (n-1)) == 0 (n & (n-1)) n (n-1) n 1 0 {
				System.out.println(n);
				break;
			} System.out.println(n) System.out.println System.out System System.out n break; String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		}
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		}
	}

} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(; n > 0; n--) {
			if((n & (n-1)) == 0) {
				System.out.println(n);
				break;
			}
		}
	}

}
