import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int max = 0;
	int max_num = 1;
	for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	}

	System.out.println(max_num);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int max = 0;
	int max_num = 1;
	for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	}

	System.out.println(max_num);
    }
} Main public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int max = 0;
	int max_num = 1;
	for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	}

	System.out.println(max_num);
    } main {
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int max = 0;
	int max_num = 1;
	for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	}

	System.out.println(max_num);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int max = 0; max 0 int max_num = 1; max_num 1 for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	} {
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	} int tmp = i; tmp i int count = 0; count 0 while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    } true {
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    } if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		} tmp % 2 == 0 tmp % 2 tmp 2 0 {
		    count++;
		    tmp /= 2;
		} count++ count tmp /= 2 tmp 2 {
		    break;
		} break; if(count > max){
		max = count;
		max_num = i;
	    } count > max count max {
		max = count;
		max_num = i;
	    } max = count max count max_num = i max_num i System.out.println(max_num) System.out.println System.out System System.out max_num String[] args args public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int max = 0;
	int max_num = 1;
	for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	}

	System.out.println(max_num);
    }
} public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int max = 0;
	int max_num = 1;
	for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	}

	System.out.println(max_num);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();

	int max = 0;
	int max_num = 1;
	for(int i = 1; i <= N; i++){
	    int tmp = i;
	    int count = 0;
	    while(true){
		if(tmp % 2 == 0){
		    count++;
		    tmp /= 2;
		}else{
		    break;
		}
	    }
	    if(count > max){
		max = count;
		max_num = i;
	    }
	}

	System.out.println(max_num);
    }
}
