import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		int num = 0;
		int result1 = 1;
		int result2 = 0;
		boolean flag;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			num = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}

		for (int i = 1; i <= num; i++) {
			int count = 0;
			int temp = i;
			flag = true;
			do {
				if (temp % 2 != 0) {
					if (result2 < count) {
						result1 = i;
						result2 = count;
					}
					flag = false;
				} else {
					temp = temp / 2;
					count++;
				}
			} while(flag);
		}

		System.out.println(result1);

	}
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz