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

public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 1;
		int hiCount = 0;
		int tempNumb = 0;
		int count = 0;
		for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		}
		System.out.println(result);

		sc.close();
	}
	
} import java.io.*; io.* java import java.util.*; util.* java public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 1;
		int hiCount = 0;
		int tempNumb = 0;
		int count = 0;
		for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		}
		System.out.println(result);

		sc.close();
	}
	
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 1;
		int hiCount = 0;
		int tempNumb = 0;
		int count = 0;
		for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		}
		System.out.println(result);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 1;
		int hiCount = 0;
		int tempNumb = 0;
		int count = 0;
		for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		}
		System.out.println(result);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int result = 1; result 1 int hiCount = 0; hiCount 0 int tempNumb = 0; tempNumb 0 int count = 0; count 0 for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		} int i = n; int i = n; i n i > 0 i 0 i-- i-- i {
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		} {
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		} tempNumb = i tempNumb i while(i % 2 == 0) {
				count++;
				i = i/2;
			} i % 2 == 0 i % 2 i 2 0 {
				count++;
				i = i/2;
			} count++ count i = i/2 i i/2 i 2 i = tempNumb i tempNumb if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			} count > hiCount count hiCount {
				result = tempNumb;
				hiCount = count;
			} result = tempNumb result tempNumb hiCount = count hiCount count count = 0 count 0 System.out.println(result) System.out.println System.out System System.out result sc.close() sc.close sc String[] args args public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 1;
		int hiCount = 0;
		int tempNumb = 0;
		int count = 0;
		for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		}
		System.out.println(result);

		sc.close();
	}
	
} public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 1;
		int hiCount = 0;
		int tempNumb = 0;
		int count = 0;
		for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		}
		System.out.println(result);

		sc.close();
	}
	
} Main
import java.io.*;
import java.util.*;

public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 1;
		int hiCount = 0;
		int tempNumb = 0;
		int count = 0;
		for(int i = n; i > 0; i--){
			tempNumb = i;
			//System.out.println("temp: " + tempNumb);
			while(i % 2 == 0) {
				count++;
				i = i/2;
			}
			//System.out.println(tempNumb);
			i = tempNumb;
//			System.out.println("i: " + i + " Count: " + count);
//			System.out.println("High Count: " + hiCount);
			if(count > hiCount) {
				result = tempNumb;
				hiCount = count;
			}
			count = 0;
		}
		System.out.println(result);

		sc.close();
	}
	
}