import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int maxCount = 0; maxCount 0 int ans = 0; ans 0 for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		} int i = n; int i = n; i n i >= 1 i 1 i-- i-- i {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		} {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		} int num = i; num i int cnt = 0; cnt 0 while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			} true {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			} if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				} num % 2 == 0 num % 2 num 2 0 {
					cnt++;
					num /= 2;
				} cnt++ cnt num /= 2 num 2 {
					break;
				} break; if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			} cnt >= maxCount cnt maxCount {
				ans = i;
				maxCount = cnt;
			} ans = i ans i maxCount = cnt maxCount cnt System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		int maxCount = 0;
		int ans = 0;
		
		for (int i = n; i >= 1; i--) {
			int num = i;
			int cnt = 0;
			
			while(true) {
				if (num % 2 == 0) {
					cnt++;
					num /= 2;
				} else {
					break;
				}
			}
			
			if (cnt >= maxCount) {
				ans = i;
				maxCount = cnt;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}