public class TestArray2 {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            Integer integer = Integer.valueOf(scanner.next());
            int re = getRe(integer);
            System.out.println(re);
        }
    }

    private static int getRe(int a) {
        int re;//将a转换为数组
        int[] ints = toArray(a);

        //找偶数位
        int[] ints1 = evenArray(ints);
        re = ints1[0];
        return re;
    }

    private static int[] toArray(int a) {
        int[] ints = new int[a + 1];
        for (int i = 0; i <= a; i++) {
            ints[i] = i;
        }
        return ints;
    }

    //传进去一个数组,返回偶数位的值组成的数组
    private static int[] evenArray(int[] array) {
        if (array.length == 1) {
            return array;
        } else {
            int[] ints = new int[array.length / 2];  //
            int j = 0;
            for (int i = 0; i < array.length; i++) {
                if ((i + 1) % 2 == 0) {
                    ints[j] = array[i];
                    j++;
                }
            }
            return evenArray(ints);
        }
    }
}