import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int count;
    int max = 0;
    int r = 0;

    for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    }

    System.out.println(r);

  }

} 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 count;
    int max = 0;
    int r = 0;

    for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    }

    System.out.println(r);

  }

} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int count;
    int max = 0;
    int r = 0;

    for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    }

    System.out.println(r);

  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int count;
    int max = 0;
    int r = 0;

    for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    }

    System.out.println(r);

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int count; count int max = 0; max 0 int r = 0; r 0 for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    } int i = n; int i = n; i n i > 0 i 0 i-- i-- i {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    } {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    } count = 0 count 0 int k = i; k i while (k%2 == 0) {
        k /= 2;
        count++;
      } k%2 == 0 k%2 k 2 0 {
        k /= 2;
        count++;
      } k /= 2 k 2 count++ count max = Math.max(max,count) max Math.max(max,count) Math.max Math max count if (max == count) {
        r = i;
      } max == count max count {
        r = i;
      } r = i r i System.out.println(r) System.out.println System.out System System.out r String[] args args public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int count;
    int max = 0;
    int r = 0;

    for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    }

    System.out.println(r);

  }

} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int count;
    int max = 0;
    int r = 0;

    for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    }

    System.out.println(r);

  }

} Main
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    int count;
    int max = 0;
    int r = 0;

    for (int i = n; i > 0; i--) {
      count = 0;
      int k = i;
      while (k%2 == 0) {
        k /= 2;
        count++;
      }
      max = Math.max(max,count);
      if (max == count) {
        r = i;
      }
    }

    System.out.println(r);

  }

}
