import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int max = 0;
    int ans = 0;
    int cnt = 0;

    for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int max = 0;
    int ans = 0;
    int cnt = 0;

    for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int max = 0;
    int ans = 0;
    int cnt = 0;

    for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    }
    System.out.println(ans);
  } main {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int max = 0;
    int ans = 0;
    int cnt = 0;

    for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    }
    System.out.println(ans);
  } 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 ans = 0; ans 0 int cnt = 0; cnt 0 for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    } {
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    } int j = i; j i while(j % 2 == 0){
        j /= 2;
        cnt++;
      } j % 2 == 0 j % 2 j 2 0 {
        j /= 2;
        cnt++;
      } j /= 2 j 2 cnt++ cnt if(cnt >= max){
        max = cnt;
        ans = i;
      } cnt >= max cnt max {
        max = cnt;
        ans = i;
      } max = cnt max cnt ans = i ans i cnt = 0 cnt 0 System.out.println(ans) System.out.println System.out System System.out ans 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 ans = 0;
    int cnt = 0;

    for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    }
    System.out.println(ans);
  }
} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int max = 0;
    int ans = 0;
    int cnt = 0;

    for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    }
    System.out.println(ans);
  }
} Main
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int max = 0;
    int ans = 0;
    int cnt = 0;

    for(int i = 1; i <= n; i++){
      int j = i;
      while(j % 2 == 0){
        j /= 2;
        cnt++;
      }
      if(cnt >= max){
        max = cnt;
        ans = i;
      }
      cnt = 0;
    }
    System.out.println(ans);
  }
}
