
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int max = 0;
		int sum = 0;
		int num = 0;
		int tmp = 0;
		int N = scan.nextInt();
		for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		}
		System.out.println(num);
		scan.close();

	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int max = 0;
		int sum = 0;
		int num = 0;
		int tmp = 0;
		int N = scan.nextInt();
		for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		}
		System.out.println(num);
		scan.close();

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int max = 0;
		int sum = 0;
		int num = 0;
		int tmp = 0;
		int N = scan.nextInt();
		for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		}
		System.out.println(num);
		scan.close();

	} main {
		Scanner scan = new Scanner(System.in);
		int max = 0;
		int sum = 0;
		int num = 0;
		int tmp = 0;
		int N = scan.nextInt();
		for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		}
		System.out.println(num);
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int max = 0; max 0 int sum = 0; sum 0 int num = 0; num 0 int tmp = 0; tmp 0 int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		} int i =N; int i =N; i N i > 0 i 0 i-- i-- i {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		} {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		} tmp = i tmp i while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			} true {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			} if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				} tmp % 2 == 0 && tmp > 0 tmp % 2 == 0 tmp % 2 tmp 2 0 tmp > 0 tmp 0 {
					sum++;
					tmp /= 2;
				} sum++ sum tmp /= 2 tmp 2 {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				} if(max <= sum) {
						max = sum;
						num = i;
					} max <= sum max sum {
						max = sum;
						num = i;
					} max = sum max sum num = i num i sum = 0 sum 0 break; System.out.println(num) System.out.println System.out System System.out num scan.close() scan.close scan String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int max = 0;
		int sum = 0;
		int num = 0;
		int tmp = 0;
		int N = scan.nextInt();
		for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		}
		System.out.println(num);
		scan.close();

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int max = 0;
		int sum = 0;
		int num = 0;
		int tmp = 0;
		int N = scan.nextInt();
		for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		}
		System.out.println(num);
		scan.close();

	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int max = 0;
		int sum = 0;
		int num = 0;
		int tmp = 0;
		int N = scan.nextInt();
		for(int i =N; i > 0; i--) {
			tmp = i;
			while(true) {
				if(tmp % 2 == 0 && tmp > 0) {
					sum++;
					tmp /= 2;
				} else {
					if(max <= sum) {
						max = sum;
						num = i;
					}
					sum = 0;
					break;
				}
			}
		}
		System.out.println(num);
		scan.close();

	}

}
