import java.util.*;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		int max = -1;
		for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java import java.math.BigInteger; BigInteger java.math import java.security.NoSuchAlgorithmException; NoSuchAlgorithmException java.security import java.util.ArrayList; ArrayList java.util import java.util.HashMap; HashMap java.util public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		int max = -1;
		for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		int max = -1;
		for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		}
		System.out.println(ans);
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		int max = -1;
		for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans = 0; ans 0 int max = -1; max -1 1 for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		} {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		} int cc = 0; cc 0 int ck = i; ck i while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			} ck % 2 == 0 ck % 2 ck 2 0 {
				ck /= 2;
				cc++;
			} ck /= 2 ck 2 cc++ cc if(max < cc) {
				ans = i;
				max = cc;
			} max < cc max cc {
				ans = i;
				max = cc;
			} ans = i ans i max = cc max cc System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		int max = -1;
		for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		int max = -1;
		for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int ans = 0;
		int max = -1;
		for(int i = 1; i <= N; i++) {
			int cc = 0;
			int ck = i;
			while(ck % 2 == 0) {
				ck /= 2;
				cc++;
			}
			if(max < cc) {
				ans = i;
				max = cc;
			}
		}
		System.out.println(ans);
	}
}