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