import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}
 import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int result = 0; result 0 int cnt = 0; cnt 0 for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		} {
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		} int c = i; c i int tmp = 0; tmp 0 while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    } c%2 == 0 c%2 c 2 0 {
		        c /= 2;
		        tmp++;
		    } c /= 2 c 2 tmp++ tmp if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    } cnt <= tmp cnt tmp {
		        result = i;
		        cnt = tmp;
		    } result = i result i cnt = tmp cnt tmp System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	}
} Main
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = 0;
		int cnt = 0;
		for(int i = 1; i <= n; i++){
		    int c = i;
		    int tmp = 0;
		    while(c%2 == 0){
		        c /= 2;
		        tmp++;
		    }
		    if(cnt <= tmp){
		        result = i;
		        cnt = tmp;
		    }
		}
		
		// 出力
		System.out.println(result);
	}
}

