import java.io.*;
import java.util.*;

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

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