import java.util.Scanner;

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        int ans_cnt = -1;
        for (int i = 1; i <= n; i++) {
            int tmp = i;
            int cnt = 0;
            while (true) {
                if (tmp % 2 == 0) {
                    cnt++;
                } else {
                    break;
                }
                tmp /= 2;
            }
            if (ans_cnt < cnt) {
                ans_cnt = cnt;
                ans = i;
            }
        }

        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        int ans_cnt = -1;
        for (int i = 1; i <= n; i++) {
            int tmp = i;
            int cnt = 0;
            while (true) {
                if (tmp % 2 == 0) {
                    cnt++;
                } else {
                    break;
                }
                tmp /= 2;
            }
            if (ans_cnt < cnt) {
                ans_cnt = 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 = 0;
        int ans_cnt = -1;
        for (int i = 1; i <= n; i++) {
            int tmp = i;
            int cnt = 0;
            while (true) {
                if (tmp % 2 == 0) {
                    cnt++;
                } else {
                    break;
                }
                tmp /= 2;
            }
            if (ans_cnt < cnt) {
                ans_cnt = cnt;
                ans = i;
            }
        }

        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

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

        int n = sc.nextInt();
        int ans = 0;
        int ans_cnt = -1;
        for (int i = 1; i <= n; i++) {
            int tmp = i;
            int cnt = 0;
            while (true) {
                if (tmp % 2 == 0) {
                    cnt++;
                } else {
                    break;
                }
                tmp /= 2;
            }
            if (ans_cnt < cnt) {
                ans_cnt = cnt;
                ans = i;
            }
        }

        System.out.println(ans);
    }
} public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        int ans_cnt = -1;
        for (int i = 1; i <= n; i++) {
            int tmp = i;
            int cnt = 0;
            while (true) {
                if (tmp % 2 == 0) {
                    cnt++;
                } else {
                    break;
                }
                tmp /= 2;
            }
            if (ans_cnt < cnt) {
                ans_cnt = cnt;
                ans = i;
            }
        }

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

public class Main {
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int ans = 0;
        int ans_cnt = -1;
        for (int i = 1; i <= n; i++) {
            int tmp = i;
            int cnt = 0;
            while (true) {
                if (tmp % 2 == 0) {
                    cnt++;
                } else {
                    break;
                }
                tmp /= 2;
            }
            if (ans_cnt < cnt) {
                ans_cnt = cnt;
                ans = i;
            }
        }

        System.out.println(ans);
    }
}