import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		String input = s.nextLine();
		int n = Integer.parseInt(input);
		
		int m = n;
		int pow = 0;
		do {
			m /= 2;
			pow++;
		}while(m > 1);
		
		int result = 1;
		if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		}
		System.out.println(result);		
		
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		String input = s.nextLine();
		int n = Integer.parseInt(input);
		
		int m = n;
		int pow = 0;
		do {
			m /= 2;
			pow++;
		}while(m > 1);
		
		int result = 1;
		if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		}
		System.out.println(result);		
		
	}

} Main public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		String input = s.nextLine();
		int n = Integer.parseInt(input);
		
		int m = n;
		int pow = 0;
		do {
			m /= 2;
			pow++;
		}while(m > 1);
		
		int result = 1;
		if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		}
		System.out.println(result);		
		
	} main {
		
		Scanner s = new Scanner(System.in);
		String input = s.nextLine();
		int n = Integer.parseInt(input);
		
		int m = n;
		int pow = 0;
		do {
			m /= 2;
			pow++;
		}while(m > 1);
		
		int result = 1;
		if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		}
		System.out.println(result);		
		
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) String input = s.nextLine(); input s.nextLine() s.nextLine s int n = Integer.parseInt(input); n Integer.parseInt(input) Integer.parseInt Integer input int m = n; m n int pow = 0; pow 0 do {
			m /= 2;
			pow++;
		}while(m > 1); m > 1 m 1 {
			m /= 2;
			pow++;
		} m /= 2 m 2 pow++ pow int result = 1; result 1 if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		} m == 1 m 1 {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} for(int i = 0; i < pow; i++) {
				result *= 2;
			} int i = 0; int i = 0; i 0 i < pow i pow i++ i++ i {
				result *= 2;
			} {
				result *= 2;
			} result *= 2 result 2 {
			result = n;
		} result = n result n System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		String input = s.nextLine();
		int n = Integer.parseInt(input);
		
		int m = n;
		int pow = 0;
		do {
			m /= 2;
			pow++;
		}while(m > 1);
		
		int result = 1;
		if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		}
		System.out.println(result);		
		
	}

} public class Main {

	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		String input = s.nextLine();
		int n = Integer.parseInt(input);
		
		int m = n;
		int pow = 0;
		do {
			m /= 2;
			pow++;
		}while(m > 1);
		
		int result = 1;
		if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		}
		System.out.println(result);		
		
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		String input = s.nextLine();
		int n = Integer.parseInt(input);
		
		int m = n;
		int pow = 0;
		do {
			m /= 2;
			pow++;
		}while(m > 1);
		
		int result = 1;
		if(m == 1) {
			for(int i = 0; i < pow; i++) {
				result *= 2;
			}
		} else {
			result = n;
		}
		System.out.println(result);		
		
	}

}
