import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int maxCount = 0;
		int maxN = 1;
		
		for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		}
		
		System.out.println(maxN);

	}

} import java.io.*; io.* java import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int maxCount = 0;
		int maxN = 1;
		
		for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		}
		
		System.out.println(maxN);

	}

} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int maxCount = 0;
		int maxN = 1;
		
		for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		}
		
		System.out.println(maxN);

	} main {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int maxCount = 0;
		int maxN = 1;
		
		for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		}
		
		System.out.println(maxN);

	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int maxCount = 0; maxCount 0 int maxN = 1; maxN 1 for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		} {
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		} int count = 0; count 0 int tmp = i; tmp i while(tmp%2 == 0){
				tmp /= 2;
				count++;
			} tmp%2 == 0 tmp%2 tmp 2 0 {
				tmp /= 2;
				count++;
			} tmp /= 2 tmp 2 count++ count if(count > maxCount){
				maxCount = count;
				maxN = i;
			} count > maxCount count maxCount {
				maxCount = count;
				maxN = i;
			} maxCount = count maxCount count maxN = i maxN i System.out.println(maxN) System.out.println System.out System System.out maxN String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int maxCount = 0;
		int maxN = 1;
		
		for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		}
		
		System.out.println(maxN);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int maxCount = 0;
		int maxN = 1;
		
		for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		}
		
		System.out.println(maxN);

	}

} Main
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int maxCount = 0;
		int maxN = 1;
		
		for(int i = 1; i <= n; i++){
			int count = 0;
			int tmp = i;
			while(tmp%2 == 0){
				tmp /= 2;
				count++;
			}
			if(count > maxCount){
				maxCount = count;
				maxN = i;
			}
		}
		
		System.out.println(maxN);

	}

}
