import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Main.run();
    }

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    }

    private static int countOfDividedByTwo(int pnum) {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    }

} import java.io.BufferedOutputStream; BufferedOutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Main.run();
    }

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    }

    private static int countOfDividedByTwo(int pnum) {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    }

} Main public static PrintWriter out; out public static void main(String[] args) {
        Main.run();
    } main {
        Main.run();
    } Main.run() Main.run Main String[] args args private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    } run {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    } out = new PrintWriter(new BufferedOutputStream(System.out)) out new PrintWriter(new BufferedOutputStream(System.out)) Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int answer = 1; answer 1 for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        } int i = 1, count = 0, maxcount = 0; int i = 1 i 1 count = 0 count 0 maxcount = 0; maxcount 0 i <= n i n i++ i++ i {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        } {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        } count = Main.countOfDividedByTwo(i) count Main.countOfDividedByTwo(i) Main.countOfDividedByTwo Main i if (maxcount < count) {
                answer = i;
                maxcount = count;
            } maxcount < count maxcount count {
                answer = i;
                maxcount = count;
            } answer = i answer i maxcount = count maxcount count out.println(answer) out.println out answer out.close() out.close out sc.close() sc.close sc private static int countOfDividedByTwo(int pnum) {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    } countOfDividedByTwo {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    } int count = 0; count 0 int n = pnum; n pnum while (n % 2 == 0) {
            n = n / 2;
            count++;
        } n % 2 == 0 n % 2 n 2 0 {
            n = n / 2;
            count++;
        } n = n / 2 n n / 2 n 2 count++ count return count; count int pnum pnum public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Main.run();
    }

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    }

    private static int countOfDividedByTwo(int pnum) {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    }

} public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Main.run();
    }

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    }

    private static int countOfDividedByTwo(int pnum) {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    }

} Main
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Main.run();
    }

    private static void run() {
        out = new PrintWriter(new BufferedOutputStream(System.out));
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int answer = 1;
        for (int i = 1, count = 0, maxcount = 0; i <= n; i++) {
            // iを2で割れる回数
            count = Main.countOfDividedByTwo(i);
            // 最高記録を上回る場合
            if (maxcount < count) {
                answer = i;
                maxcount = count;
            }
        }
        out.println(answer);
        out.close();
        sc.close();
    }

    private static int countOfDividedByTwo(int pnum) {
        int count = 0;
        int n = pnum;
        while (n % 2 == 0) {
            n = n / 2;
            count++;
        }
        return count;
    }

}
