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);

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io 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);

	}
} 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);

	} main {
		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);

	} int num = 0; num 0 int result1 = 1; result1 1 int result2 = 0; result2 0 boolean flag; flag BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {
			num = Integer.parseInt(br.readLine());
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			num = Integer.parseInt(br.readLine());
		} num = Integer.parseInt(br.readLine()) num Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br 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);
		} int i = 1; int i = 1; i 1 i <= num i num i++ i++ 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);
		} {
			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);
		} int count = 0; count 0 int temp = i; temp i flag = true flag true do {
				if (temp % 2 != 0) {
					if (result2 < count) {
						result1 = i;
						result2 = count;
					}
					flag = false;
				} else {
					temp = temp / 2;
					count++;
				}
			} while(flag); flag {
				if (temp % 2 != 0) {
					if (result2 < count) {
						result1 = i;
						result2 = count;
					}
					flag = false;
				} else {
					temp = temp / 2;
					count++;
				}
			} if (temp % 2 != 0) {
					if (result2 < count) {
						result1 = i;
						result2 = count;
					}
					flag = false;
				} else {
					temp = temp / 2;
					count++;
				} temp % 2 != 0 temp % 2 temp 2 0 {
					if (result2 < count) {
						result1 = i;
						result2 = count;
					}
					flag = false;
				} if (result2 < count) {
						result1 = i;
						result2 = count;
					} result2 < count result2 count {
						result1 = i;
						result2 = count;
					} result1 = i result1 i result2 = count result2 count flag = false flag false {
					temp = temp / 2;
					count++;
				} temp = temp / 2 temp temp / 2 temp 2 count++ count System.out.println(result1) System.out.println System.out System System.out result1 String[] args args 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);

	}
} 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);

	}
} Main
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);

	}
}
