import java.util.Scanner;

public class Main {
  private static int countPower(int n) {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  }
} import java.util.Scanner; Scanner java.util public class Main {
  private static int countPower(int n) {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  }
} Main private static int countPower(int n) {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  } countPower {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  } int count = 0; count 0 while (n % 2 == 0) {
      ++count;
      n /= 2;
    } n % 2 == 0 n % 2 n 2 0 {
      ++count;
      n /= 2;
    } ++count count n /= 2 n 2 return count; count int n n public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  } 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 max = 0; max 0 for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    } int i = 1; int i = 1; i 1 i <= n i n ++i ++i i {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    } {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    } int count = countPower(i); count countPower(i) countPower i if (max < count) {
        max = count;
        ans = i;
      } max < count max count {
        max = count;
        ans = i;
      } max = count max count ans = i ans i System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String args[] args public class Main {
  private static int countPower(int n) {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  }
} public class Main {
  private static int countPower(int n) {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  }
} Main
import java.util.Scanner;

public class Main {
  private static int countPower(int n) {
    int count = 0;
    while (n % 2 == 0) {
      ++count;
      n /= 2;
    }
    return count;
  }

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    int max = 0;
    for (int i = 1; i <= n; ++i) {
      int count = countPower(i);
      if (max < count) {
        max = count;
        ans = i;
      }
    }

    System.out.println(ans);
    
    sc.close(); 
  }
}
