import java.util.*;
import java.lang.*;


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


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