import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   int n=sc.nextInt();
    int cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  }
} 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 cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   int n=sc.nextInt();
    int cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  } main {
    Scanner sc = new Scanner(System.in);
   int n=sc.nextInt();
    int cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int cnt=0; cnt 0 int max=-1; max -1 1 int val=0; val 0 for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    } {
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    } int element=i; element i boolean ok=true; ok true while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      } ok {
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      } if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        } element%2==0 element%2 element 2 0 {
          cnt++;
          element=element/2;
        } cnt++ cnt element=element/2 element element/2 element 2 {
          ok=false;
        } ok=false ok false if(max<cnt){
        max=cnt;
        val=i;
      } max<cnt max cnt {
        max=cnt;
        val=i;
      } max=cnt max cnt val=i val i cnt=0 cnt 0 System.out.println(val) System.out.println System.out System System.out val String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   int n=sc.nextInt();
    int cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   int n=sc.nextInt();
    int cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
   int n=sc.nextInt();
    int cnt=0;
    int max=-1;
    int val=0;
    for(int i=1; i<=n; i++){
      int element=i;
      boolean ok=true;
      while(ok){
        if(element%2==0){
          cnt++;
          element=element/2;
        }else{
          ok=false;
        }
      }
      if(max<cnt){
        max=cnt;
        val=i;
      }
      cnt=0;
    }
    System.out.println(val);
  }
}