import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int divCnt;
        int maxDivCnt = 0;
        int maxN = 1;

        for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        }
        System.out.println(maxN);
    }

    private static int divCnt(int i) {
        int cnt = 0;
        return divCnt(i, cnt);
    }

    private static int divCnt(int i,int cnt) {
        if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        }
        return cnt;
    }

} 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 divCnt;
        int maxDivCnt = 0;
        int maxN = 1;

        for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        }
        System.out.println(maxN);
    }

    private static int divCnt(int i) {
        int cnt = 0;
        return divCnt(i, cnt);
    }

    private static int divCnt(int i,int cnt) {
        if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        }
        return cnt;
    }

} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int divCnt;
        int maxDivCnt = 0;
        int maxN = 1;

        for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        }
        System.out.println(maxN);
    } main {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int divCnt;
        int maxDivCnt = 0;
        int maxN = 1;

        for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        }
        System.out.println(maxN);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int divCnt; divCnt int maxDivCnt = 0; maxDivCnt 0 int maxN = 1; maxN 1 for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        } int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        } {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        } divCnt = divCnt(i) divCnt divCnt(i) divCnt i if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            } maxDivCnt < divCnt maxDivCnt divCnt {
                maxDivCnt = divCnt;
                maxN = i;
            } maxDivCnt = divCnt maxDivCnt divCnt maxN = i maxN i System.out.println(maxN) System.out.println System.out System System.out maxN String[] args args private static int divCnt(int i) {
        int cnt = 0;
        return divCnt(i, cnt);
    } divCnt {
        int cnt = 0;
        return divCnt(i, cnt);
    } int cnt = 0; cnt 0 return divCnt(i, cnt); divCnt(i, cnt) divCnt i cnt int i i private static int divCnt(int i,int cnt) {
        if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        }
        return cnt;
    } divCnt {
        if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        }
        return cnt;
    } if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        } i/2 >= 1 && i%2 == 0 i/2 >= 1 i/2 i 2 1 i%2 == 0 i%2 i 2 0 {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        } i = i /2 i i /2 i 2 cnt = divCnt(i,cnt) cnt divCnt(i,cnt) divCnt i cnt cnt ++ cnt return cnt; cnt int i i int cnt cnt public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int divCnt;
        int maxDivCnt = 0;
        int maxN = 1;

        for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        }
        System.out.println(maxN);
    }

    private static int divCnt(int i) {
        int cnt = 0;
        return divCnt(i, cnt);
    }

    private static int divCnt(int i,int cnt) {
        if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        }
        return cnt;
    }

} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();

        int divCnt;
        int maxDivCnt = 0;
        int maxN = 1;

        for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        }
        System.out.println(maxN);
    }

    private static int divCnt(int i) {
        int cnt = 0;
        return divCnt(i, cnt);
    }

    private static int divCnt(int i,int cnt) {
        if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        }
        return cnt;
    }

} 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 divCnt;
        int maxDivCnt = 0;
        int maxN = 1;

        for (int i = 1; i <= N; i++) {

            divCnt = divCnt(i);
            if(maxDivCnt < divCnt) {
                maxDivCnt = divCnt;
                maxN = i;
            }
        }
        System.out.println(maxN);
    }

    private static int divCnt(int i) {
        int cnt = 0;
        return divCnt(i, cnt);
    }

    private static int divCnt(int i,int cnt) {
        if(i/2 >= 1 && i%2 == 0) {
            i = i /2;
            cnt = divCnt(i,cnt);
            cnt ++;
        }
        return cnt;
    }

}