import java.util.Scanner;

public class Main {
	public static void main(String ...args) {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String ...args) {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	}
} Main public static void main(String ...args) {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	} main {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	} try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		} {
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner String N2 = Integer.toBinaryString(N); N2 Integer.toBinaryString(N) Integer.toBinaryString Integer N String N3 = N2.replaceAll("1", "0"); N3 N2.replaceAll("1", "0") N2.replaceAll N2 "1" "0" String N4 = N3.replaceFirst("^0", "1"); N4 N3.replaceFirst("^0", "1") N3.replaceFirst N3 "^0" "1" System.out.println(Integer.parseInt(N4, 2)) System.out.println System.out System System.out Integer.parseInt(N4, 2) Integer.parseInt Integer N4 2 String ...args args public class Main {
	public static void main(String ...args) {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	}
} public class Main {
	public static void main(String ...args) {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String ...args) {
		try(Scanner scanner = new Scanner(System.in)){
			int N = scanner.nextInt();
			String N2 = Integer.toBinaryString(N);
			String N3 = N2.replaceAll("1", "0");
			String N4 = N3.replaceFirst("^0", "1");
			System.out.println(Integer.parseInt(N4, 2));
		}
	}
}
