import java.util.Scanner;

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

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