import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int cntmax = -1;
		int cnt, ii;
		int imax = 0;
		for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		}
		System.out.println(imax);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int cntmax = -1;
		int cnt, ii;
		int imax = 0;
		for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		}
		System.out.println(imax);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int cntmax = -1;
		int cnt, ii;
		int imax = 0;
		for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		}
		System.out.println(imax);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int cntmax = -1;
		int cnt, ii;
		int imax = 0;
		for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		}
		System.out.println(imax);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc int cntmax = -1; cntmax -1 1 int cnt cnt ii; ii int imax = 0; imax 0 for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		} int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		} {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		} cnt =0 cnt 0 ii =i ii i while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			} true {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			} if(ii%2==1)break; ii%2==1 ii%2 ii 2 1 break; ii=ii/2 ii ii/2 ii 2 cnt++ cnt if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			} cnt > cntmax cnt cntmax {
				cntmax = cnt;
				imax = i;
			} cntmax = cnt cntmax cnt imax = i imax i System.out.println(imax) System.out.println System.out System System.out imax String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int cntmax = -1;
		int cnt, ii;
		int imax = 0;
		for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		}
		System.out.println(imax);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int cntmax = -1;
		int cnt, ii;
		int imax = 0;
		for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		}
		System.out.println(imax);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		sc.close();
		int cntmax = -1;
		int cnt, ii;
		int imax = 0;
		for(int i = 1; i <= n; i++) {
			cnt =0;
			ii =i;
			while(true) {
				if(ii%2==1)break;
				ii=ii/2;
				cnt++;
			}
//			System.out.println(""+i+":"+cnt);
			if(cnt > cntmax) {
				cntmax = cnt;
				imax = i;
			}
		}
		System.out.println(imax);
	}
}
