import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int maxCount = 0;
        int maxNum = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        }
        System.out.println(maxNum);
    }

} 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 maxCount = 0;
        int maxNum = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        }
        System.out.println(maxNum);
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int maxCount = 0;
        int maxNum = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        }
        System.out.println(maxNum);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int maxCount = 0;
        int maxNum = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        }
        System.out.println(maxNum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int maxCount = 0; maxCount 0 int maxNum = 0; maxNum 0 for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        } {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        } int count = 0; count 0 int num = i + 1; num i + 1 i 1 while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            } true {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            } if (num % 2 != 0) {
                    break;
                } num % 2 != 0 num % 2 num 2 0 {
                    break;
                } break; num /= 2 num 2 count++ count if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            } i == 0 || count > maxCount i == 0 i 0 count > maxCount count maxCount {
                maxCount = count;
                maxNum = i + 1;
            } maxCount = count maxCount count maxNum = i + 1 maxNum i + 1 i 1 System.out.println(maxNum) System.out.println System.out System System.out maxNum String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int maxCount = 0;
        int maxNum = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        }
        System.out.println(maxNum);
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int maxCount = 0;
        int maxNum = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        }
        System.out.println(maxNum);
    }

} 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 maxCount = 0;
        int maxNum = 0;
        for (int i = 0; i < n; i++) {
            int count = 0;
            int num = i + 1;
            while (true) {
                if (num % 2 != 0) {
                    break;
                }
                num /= 2;
                count++;
            }
            if (i == 0 || count > maxCount) {
                maxCount = count;
                maxNum = i + 1;
            }
        }
        System.out.println(maxNum);
    }

}
