import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		sc.close();

		for (int i = 62; i >= 0; i--) {
			if ((n >> i & 1) == 1) {
				System.out.println(1L << i);
				return;
			}
		}
	}
}