import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] num = new int[N + 1]; num new int[N + 1] N + 1 N 1 for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		} int i = 1; int i = 1; i 1 i <= N i N i ++ i ++ i {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		} {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		} num[i] = 0 num[i] num i 0 int x = i; x i for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			} int k = 0; int k = 0; k 0 k ++ k ++ k {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			} {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			} if(x % 2 != 0)break; x % 2 != 0 x % 2 x 2 0 break; x = x / 2 x x / 2 x 2 num[i] ++ num[i] num i int maxidx = 1 maxidx 1 max = num[1]; max num[1] num 1 for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		} int i = 2; int i = 2; i 2 i < N + 1 i N + 1 N 1 i ++ i ++ i {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		} {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		} if(max < num[i]) {
				maxidx = i;
				max = num[i];
			} max < num[i] max num[i] num i {
				maxidx = i;
				max = num[i];
			} maxidx = i maxidx i max = num[i] max num[i] num i System.out.println(maxidx) System.out.println System.out System System.out maxidx String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] num = new int[N + 1];
		for(int i = 1;i <= N;i ++) {
			num[i] = 0;
			int x = i;
			for(int k = 0;;k ++) {
				if(x % 2 != 0)break;
				x = x / 2;
				num[i] ++;
			}
		}
		int maxidx = 1,max = num[1];
		for(int i = 2;i < N + 1;i ++) {
			if(max < num[i]) {
				maxidx = i;
				max = num[i];
			}
		}
		System.out.println(maxidx);
	}
}