import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    } main {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    } 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 max = 0; max 0 int highest = 1; highest 1 for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        } int i = 1; int i = 1; i 1 i < n + 1 i n + 1 n 1 i++ i++ i {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        } {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        } int x = i; x i int ans = 0; ans 0 while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            } x % 2 == 0 x % 2 x 2 0 {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            } x /= 2 x 2 ans += 1 ans 1 if (x == 0) {
                    break;
                } x == 0 x 0 {
                    break;
                } break; if (max < ans) {
                max = ans;
                highest = i;
            } max < ans max ans {
                max = ans;
                highest = i;
            } max = ans max ans highest = i highest i System.out.print(highest) System.out.print System.out System System.out highest String[] args args public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int max = 0;
        int highest = 1;

        for (int i = 1; i < n + 1; i++) {
            int x = i;
            int ans = 0;
            while (x % 2 == 0) {
                x /= 2;
                ans += 1;
                if (x == 0) {
                    break;
                }
            }
            if (max < ans) {
                max = ans;
                highest = i;
            }
        }
        System.out.print(highest);
    }
}