import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		sc.close();
		int[] Num = new int[N];
		for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		}
		int cnt = 0;
		int max = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner 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[] Num = new int[N];
		for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		}
		int cnt = 0;
		int max = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		sc.close();
		int[] Num = new int[N];
		for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		}
		int cnt = 0;
		int max = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		sc.close();
		int[] Num = new int[N];
		for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		}
		int cnt = 0;
		int max = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		}
		System.out.println(ans);
	} 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[] Num = new int[N]; Num new int[N] N for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			Num[i] = i+1;
		} {
			Num[i] = i+1;
		} Num[i] = i+1 Num[i] Num i i+1 i 1 int cnt = 0; cnt 0 int max = 0; max 0 int ans = 0; ans 0 for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		} {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		} if(N == 1) {
				ans = 1;
				break;
			} N == 1 N 1 {
				ans = 1;
				break;
			} ans = 1 ans 1 break; int k = Num[i]; k Num[i] Num i while(k%2 == 0) {
				k /= 2;
				cnt++;
			} k%2 == 0 k%2 k 2 0 {
				k /= 2;
				cnt++;
			} k /= 2 k 2 cnt++ cnt if(max < cnt) {
				max = cnt;
				ans = Num[i];
			} max < cnt max cnt {
				max = cnt;
				ans = Num[i];
			} max = cnt max cnt ans = Num[i] ans Num[i] Num i cnt = 0 cnt 0 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 = Integer.parseInt(sc.next());
		sc.close();
		int[] Num = new int[N];
		for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		}
		int cnt = 0;
		int max = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		}
		System.out.println(ans);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		sc.close();
		int[] Num = new int[N];
		for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		}
		int cnt = 0;
		int max = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		sc.close();
		int[] Num = new int[N];
		for(int i = 0;i < N;i++) {
			Num[i] = i+1;
		}
		int cnt = 0;
		int max = 0;
		int ans = 0;
		for(int i = 0;i < N;i++) {
			if(N == 1) {
				ans = 1;
				break;
			}
			int k = Num[i];
			while(k%2 == 0) {
				k /= 2;
				cnt++;
			}
			if(max < cnt) {
				max = cnt;
				ans = Num[i];
			}
			cnt = 0;
		}
		System.out.println(ans);
	}
}