import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int ansi = 0;
    for (int i = 1; i <= n; i++) {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int ansi = 0;
    for (int i = 1; i <= n; i++) {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int ansi = 0;
    for (int i = 1; i <= n; i++) {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int ansi = 0;
    for (int i = 1; i <= n; i++) {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    }
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ans = 1; ans 1 int ansi = 0; ansi 0 for (int i = 1; i <= n; i++) {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    } {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    } int tmp = i; tmp i int cnt = 0; cnt 0 while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      } tmp % 2 == 0 tmp % 2 tmp 2 0 {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      } int x = tmp / 2; x tmp / 2 tmp 2 tmp = x tmp x cnt++ cnt if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        } ansi <= cnt ansi cnt {
          ansi = cnt;
          ans = i;
        } ansi = cnt ansi cnt ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans 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 ans = 1;
    int ansi = 0;
    for (int i = 1; i <= n; i++) {
      int tmp = i;
      int cnt = 0;
      while (tmp % 2 == 0) {
        int x = tmp / 2;
        tmp = x;
        cnt++;
        if (ansi <= cnt) {
          ansi = cnt;
          ans = i;
        }
      }
    }
    System.out.println(ans);
  }
}