import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    int cnt = 0;

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

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    }

    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    int cnt = 0;

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

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    }

    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    int cnt = 0;

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

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    }

    System.out.println(ans);
  } main {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    int cnt = 0;

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

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    }

    System.out.println(ans);
  } @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int ans = 0; ans 0 int cnt = 0; cnt 0 for (int i = 1; i <= N; i++) {
      int tmp = i;
      int tmpCnt = 0;
      while (true) {
        if (tmp % 2 == 0) {
          tmp = tmp / 2;
          tmpCnt++;
        } else {
          break;
        }
      }

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
      int tmp = i;
      int tmpCnt = 0;
      while (true) {
        if (tmp % 2 == 0) {
          tmp = tmp / 2;
          tmpCnt++;
        } else {
          break;
        }
      }

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    } {
      int tmp = i;
      int tmpCnt = 0;
      while (true) {
        if (tmp % 2 == 0) {
          tmp = tmp / 2;
          tmpCnt++;
        } else {
          break;
        }
      }

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    } int tmp = i; tmp i int tmpCnt = 0; tmpCnt 0 while (true) {
        if (tmp % 2 == 0) {
          tmp = tmp / 2;
          tmpCnt++;
        } else {
          break;
        }
      } true {
        if (tmp % 2 == 0) {
          tmp = tmp / 2;
          tmpCnt++;
        } else {
          break;
        }
      } if (tmp % 2 == 0) {
          tmp = tmp / 2;
          tmpCnt++;
        } else {
          break;
        } tmp % 2 == 0 tmp % 2 tmp 2 0 {
          tmp = tmp / 2;
          tmpCnt++;
        } tmp = tmp / 2 tmp tmp / 2 tmp 2 tmpCnt++ tmpCnt {
          break;
        } break; if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      } Math.max(cnt, tmpCnt) == tmpCnt Math.max(cnt, tmpCnt) Math.max Math cnt tmpCnt tmpCnt {
        ans = i;
        cnt = tmpCnt;
      } ans = i ans i cnt = tmpCnt cnt tmpCnt 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) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    int cnt = 0;

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

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    }

    System.out.println(ans);
  }
} public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    int cnt = 0;

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

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    }

    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    @SuppressWarnings("resource")
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = 0;
    int cnt = 0;

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

      if (Math.max(cnt, tmpCnt) == tmpCnt) {
        ans = i;
        cnt = tmpCnt;
      }
    }

    System.out.println(ans);
  }
}