import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int maxNum = 1;
		for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		}
		
		System.out.println(maxNum);
		
		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 = sc.nextInt();
		
		int maxCnt = 0;
		int maxNum = 1;
		for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		}
		
		System.out.println(maxNum);
		
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int maxNum = 1;
		for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		}
		
		System.out.println(maxNum);
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int maxNum = 1;
		for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		}
		
		System.out.println(maxNum);
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int maxCnt = 0; maxCnt 0 int maxNum = 1; maxNum 1 for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		} {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		} int cnt = 0; cnt 0 int num = i; num i while (num % 2 == 0) {
				cnt++;
				num /= 2;
			} num % 2 == 0 num % 2 num 2 0 {
				cnt++;
				num /= 2;
			} cnt++ cnt num /= 2 num 2 if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			} cnt > maxCnt cnt maxCnt {
				maxCnt = cnt;
				maxNum = i;
			} maxCnt = cnt maxCnt cnt maxNum = i maxNum i System.out.println(maxNum) System.out.println System.out System System.out maxNum 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 = sc.nextInt();
		
		int maxCnt = 0;
		int maxNum = 1;
		for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		}
		
		System.out.println(maxNum);
		
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int maxNum = 1;
		for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		}
		
		System.out.println(maxNum);
		
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int maxCnt = 0;
		int maxNum = 1;
		for (int i = 1; i <= n; i++) {
			int cnt = 0;
			int num = i;
			while (num % 2 == 0) {
				cnt++;
				num /= 2;
			}
			
			if (cnt > maxCnt) {
				maxCnt = cnt;
				maxNum = i;
			}
		}
		
		System.out.println(maxNum);
		
		sc.close();
	}
}


