import java.util.*;
 
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int ans = 1;
    int count = 0;
    int x = 0;
    int n = sc.nextInt();
    for(int i=1; i<=n; i++){
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    }
    System.out.println(ans);

    sc.close();
  }

  public static int countHalf(int i){
    int count = 0;
    boolean a = true;
    while(a){
      if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      }
    }
    return count;
  }
} import java.util.*; util.* java class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int ans = 1;
    int count = 0;
    int x = 0;
    int n = sc.nextInt();
    for(int i=1; i<=n; i++){
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    }
    System.out.println(ans);

    sc.close();
  }

  public static int countHalf(int i){
    int count = 0;
    boolean a = true;
    while(a){
      if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      }
    }
    return count;
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int ans = 1;
    int count = 0;
    int x = 0;
    int n = sc.nextInt();
    for(int i=1; i<=n; i++){
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    }
    System.out.println(ans);

    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);
    
    int ans = 1;
    int count = 0;
    int x = 0;
    int n = sc.nextInt();
    for(int i=1; i<=n; i++){
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    }
    System.out.println(ans);

    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 1; ans 1 int count = 0; count 0 int x = 0; x 0 int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i=1; i<=n; i++){
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    } {
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    } if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      } i%2 == 0 i%2 i 2 0 {
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      } x = countHalf(i) x countHalf(i) countHalf i if(count < x){
          count = x;
          ans = i;
        } count < x count x {
          count = x;
          ans = i;
        } count = x count x ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String[] args args public static int countHalf(int i){
    int count = 0;
    boolean a = true;
    while(a){
      if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      }
    }
    return count;
  } countHalf {
    int count = 0;
    boolean a = true;
    while(a){
      if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      }
    }
    return count;
  } int count = 0; count 0 boolean a = true; a true while(a){
      if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      }
    } a {
      if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      }
    } if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      } i%2 == 0 i%2 i 2 0 {
        i /= 2;
        count++;
      } i /= 2 i 2 count++ count {
        a = false;
      } a = false a false return count; count int i i
import java.util.*;
 
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int ans = 1;
    int count = 0;
    int x = 0;
    int n = sc.nextInt();
    for(int i=1; i<=n; i++){
      if(i%2 == 0){
        x = countHalf(i);
        if(count < x){
          count = x;
          ans = i;
        }
      }
    }
    System.out.println(ans);

    sc.close();
  }

  public static int countHalf(int i){
    int count = 0;
    boolean a = true;
    while(a){
      if(i%2 == 0){
        i /= 2;
        count++;
      } else {
        a = false;
      }
    }
    return count;
  }
}
