import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int nmax = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		}
		System.out.println(nmax);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int nmax = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		}
		System.out.println(nmax);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int nmax = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		}
		System.out.println(nmax);
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int nmax = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		}
		System.out.println(nmax);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int max = 0; max 0 int nmax = 0; nmax 0 for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		} {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		} int count = 0; count 0 boolean f = true; f true int a = i; a i while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			} f {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			} if (a%2==0) {
					count++;
					a = a/2;
					continue;
				} a%2==0 a%2 a 2 0 {
					count++;
					a = a/2;
					continue;
				} count++ count a = a/2 a a/2 a 2 continue; if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				} a%2==1 a%2 a 2 1 {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				} if (max <= count) {
						max = count;
						nmax = i;
					} max <= count max count {
						max = count;
						nmax = i;
					} max = count max count nmax = i nmax i f = false f false System.out.println(nmax) System.out.println System.out System System.out nmax String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int nmax = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		}
		System.out.println(nmax);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int nmax = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		}
		System.out.println(nmax);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int max = 0;
		int nmax = 0;
		for (int i = 1; i <= n; i++) {
			int count = 0;
			boolean f = true;
			int a = i;
			while (f) {
				if (a%2==0) {
					count++;
					a = a/2;
					continue;
				}
				if (a%2==1) {
					if (max <= count) {
						max = count;
						nmax = i;
					}
					f = false;
				}
			}
		}
		System.out.println(nmax);
	}
}
