import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int cnt = 0;
        int maxCnt = 0;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        }
        if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int cnt = 0;
        int maxCnt = 0;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        }
        if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        }
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int cnt = 0;
        int maxCnt = 0;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        }
        if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int cnt = 0;
        int maxCnt = 0;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        }
        if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        }
    } 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 cnt = 0; cnt 0 int maxCnt = 0; maxCnt 0 int ans = 0; ans 0 for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        } int i = 1; int i = 1; i 1 i <= n i n i++ i++ i {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        } {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        } cnt = 0 cnt 0 int divided = i; divided i while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            } true {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            } if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                } divided % 2 != 0 divided % 2 divided 2 0 {
                    break;
                } break; {
                    divided = divided / 2;
                    cnt++;
                } divided = divided / 2 divided divided / 2 divided 2 cnt++ cnt if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                } cnt > maxCnt cnt maxCnt {
                    maxCnt = cnt;
                    ans = i;
                } maxCnt = cnt maxCnt cnt ans = i ans i if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        } n == 1 n 1 {
            System.out.println(1);
        } System.out.println(1) System.out.println System.out System System.out 1 {
            System.out.println(ans);   
        } 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) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int cnt = 0;
        int maxCnt = 0;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        }
        if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int cnt = 0;
        int maxCnt = 0;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        }
        if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int cnt = 0;
        int maxCnt = 0;
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            cnt = 0;
            int divided = i;
            while (true) {
                if (divided % 2 != 0) {
                    break;
                } else {
                    divided = divided / 2;
                    cnt++;
                }
                if (cnt > maxCnt) {
                    maxCnt = cnt;
                    ans = i;
                }
            }
        }
        if (n == 1) {
            System.out.println(1);
        } else {
            System.out.println(ans);   
        }
    }
}
