import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int max = 0;
    int maxNum = 1;
    for (int i = 1; i <= n; i++) {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    }
    System.out.println(maxNum);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int max = 0;
    int maxNum = 1;
    for (int i = 1; i <= n; i++) {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    }
    System.out.println(maxNum);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int max = 0;
    int maxNum = 1;
    for (int i = 1; i <= n; i++) {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    }
    System.out.println(maxNum);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int max = 0;
    int maxNum = 1;
    for (int i = 1; i <= n; i++) {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    }
    System.out.println(maxNum);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int max = 0; max 0 int maxNum = 1; maxNum 1 for (int i = 1; i <= n; i++) {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    } {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    } int num = i; num i int count = 0; count 0 while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      } true {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      } if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        } num % 2 == 0 num % 2 num 2 0 {
          num = num / 2;
          count++;
        } num = num / 2 num num / 2 num 2 count++ count {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        } if (count > max) {
            max = count;
            maxNum = i;
          } count > max count max {
            max = count;
            maxNum = i;
          } max = count max count maxNum = i maxNum i break; System.out.println(maxNum) System.out.println System.out System System.out maxNum String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int max = 0;
    int maxNum = 1;
    for (int i = 1; i <= n; i++) {
      int num = i;
      int count = 0;
      while (true) {
        if (num % 2 == 0) {
          num = num / 2;
          count++;
        } else {
          if (count > max) {
            max = count;
            maxNum = i;
          }
          break;
        }
      }
    }
    System.out.println(maxNum);
  }
}