import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	}
	
	private static boolean isRoot2(int num) {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	}
	
	private static boolean isRoot2(int num) {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	} main {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan if(num == 1) {
			System.out.println(num);
			return;
		} num == 1 num 1 {
			System.out.println(num);
			return;
		} System.out.println(num) System.out.println System.out System System.out num return; int most = 0; most 0 for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		} int ind = 1; int ind = 1; ind 1 ind<=num ind num ind++ ind++ ind {
			if(isRoot2(ind)) most = ind;
		} {
			if(isRoot2(ind)) most = ind;
		} if(isRoot2(ind)) most = ind; isRoot2(ind) isRoot2 ind most = ind most ind System.out.println(most) System.out.println System.out System System.out most String[] args args private static boolean isRoot2(int num) {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	} isRoot2 {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	} for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		} int ind = 1; int ind = 1; ind 1 ind<=10 ind 10 ind++ ind++ ind {
			if(num == (Math.pow(2, ind))) return true;
		} {
			if(num == (Math.pow(2, ind))) return true;
		} if(num == (Math.pow(2, ind))) return true; num == (Math.pow(2, ind)) num (Math.pow(2, ind)) Math.pow Math 2 ind return true; true return false; false int num num public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	}
	
	private static boolean isRoot2(int num) {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	}
	
	private static boolean isRoot2(int num) {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	}
} Main
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		if(num == 1) {
			System.out.println(num);
			return;
		}
		int most = 0;
		for(int ind = 1; ind<=num;ind++) {
			if(isRoot2(ind)) most = ind;
		}
		System.out.println(most);
	}
	
	private static boolean isRoot2(int num) {
		for(int ind = 1;ind<=10;ind++) {
			if(num == (Math.pow(2, ind))) return true;
		}
		return false;
	}
}
