import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int limit = sc.nextInt();
    int max =0;
    int result=1;
    for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    }
    System.out.println(result);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int limit = sc.nextInt();
    int max =0;
    int result=1;
    for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    }
    System.out.println(result);
  }
} Main public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int limit = sc.nextInt();
    int max =0;
    int result=1;
    for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    }
    System.out.println(result);
  } main {
    Scanner sc=new Scanner(System.in);
    int limit = sc.nextInt();
    int max =0;
    int result=1;
    for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    }
    System.out.println(result);
  } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int limit = sc.nextInt(); limit sc.nextInt() sc.nextInt sc int max =0; max 0 int result=1; result 1 for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    } int i=1; int i=1; i 1 i<=limit i limit i++ i++ i {
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    } {
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    } int tmp =i; tmp i int cnt=0; cnt 0 while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        } true {
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        } if(tmp%2!=0){
                break;
            } tmp%2!=0 tmp%2 tmp 2 0 {
                break;
            } break; tmp=tmp/2 tmp tmp/2 tmp 2 cnt++ cnt if(cnt>max){
            max =cnt;
            result=i;
        } cnt>max cnt max {
            max =cnt;
            result=i;
        } max =cnt max cnt result=i result i System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int limit = sc.nextInt();
    int max =0;
    int result=1;
    for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    }
    System.out.println(result);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int limit = sc.nextInt();
    int max =0;
    int result=1;
    for(int i=1; i<=limit; i++){
        int tmp =i;
        int cnt=0;
        while(true){
            if(tmp%2!=0){
                break;
            }
            tmp=tmp/2;
            cnt++;
        }
        if(cnt>max){
            max =cnt;
            result=i;
        }
    }
    System.out.println(result);
  }
} Main
import java.util.*;

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