Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible. 

Help Petya to split the integers. Each of n integers should be exactly in one group.

Input

The first line contains a single integer n (2 ≤ n ≤ 60 000) — the number of integers Petya has.

Output

Print the smallest possible absolute difference in the first line.

In the second line print the size of the first group, followed by the integers in that group. You can print these integers in arbitrary order. If there are multiple answers, print any of them.

Examples

Input

4


Output

0
2 1 4 


Input

2


Output

1
1 1 

Note

In the first example you have to put integers 1 and 4 in the first group, and 2 and 3 in the second. This way the sum in each group is 5, and the absolute difference is 0.

In the second example there are only two integers, and since both groups should be non-empty, you have to put one integer in the first group and one in the second. This way the absolute difference of sums of integers in each group is 1.
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {


    void solve() throws IOException {
        long n = readInt();
        long sum = (n * (n + 1) / 2);
        out.println(sum % 2);
        sum /= 2;
        ArrayList<Integer> list = new ArrayList<>();
        boolean[] used = new boolean[(int) n];
        for (int i = (int) n - 1; i >= 0; i--) {
            if(i+1<=sum){
                list.add(i+1);
                sum-=i+1;
            }
        }
        out.print(list.size()+" ");
        for (int i: list){
            out.print(i+" ");
        }
    }

    int checkBit(int mask, int bit) {
        return (mask >> bit) & 1;
    }

    public static void main(String[] args) throws IOException {

        new Main().run();
    }

    boolean isLower(char a) {
        return ((int) a) >= 97 ? true : false;
    }

    int INF = Integer.MAX_VALUE / 10;

    int[][] STEPS = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}};

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;
    Random rnd = new Random();
    static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    Main() throws FileNotFoundException {

        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        }

        tok = new StringTokenizer("");
    }

    long checkBit(long mask, int bit) {
        return (mask >> bit) & 1;
    }

    void run() throws IOException {
        solve();
        out.close();
    }

    char varChar;
    int varInt, varInt1, varInt2;
    long varLong;

    long sqrt(long m) {
        long l = 0;
        long r = m;
        long answer = 0;
        long mid = 0;
        while (l <= r) {
            mid = (l + r) / 2;
            if (mid * mid <= m) {
                answer = mid;
                l = mid + 1;
            } else r = mid - 1;
        }
        return answer;
    }

    int countPow(int m, int n) {
        varInt = 0;
        while (m % n == 0 && m > 0) {
            varInt++;
            m /= n;
        }
        return varInt;
    }

    long binPow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 1) {
            return a * binPow(a, b - 1);
        } else {
            varLong = binPow(a, b / 2);
            return varLong * varLong;
        }

    }

    int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    long pow(long x, long k) {
        varLong = 1;
        for (int i = 0; i < k; ++i) {
            varLong *= x;
        }
        return varLong;
    }

    class Fenwik {
        private long[] t;
        private int length;

        Fenwik(int[] a) {
            this.length = a.length + 100;
            this.t = new long[length];
            for (int i = 0; i < a.length; ++i) {
                this.inc(i, a[i]);
            }
        }

        void inc(int i, int delta) {
            for (; i < this.length; i = i | (i + 1)) {
                this.t[i] += delta;
            }
        }

        long getSum(int r) {
            long sum = 0;

            for (; r >= 0; r = (r & (r + 1)) - 1) {
                sum += this.t[r];
            }

            return sum;
        }

    }

    // ////////////////////////////////////////////////////////////////////

    String delimiter = " ";

    String readLine() throws IOException {
        return in.readLine();
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (null == nextLine)
                return null;

            tok = new StringTokenizer(nextLine);
        }

        return tok.nextToken(delimiter);
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    int[] readIntArray(int b) {
        int a[] = new int[b];
        for (int i = 0; i < b; i++) {
            try {
                a[i] = readInt();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return a;
    }

    int[] readSortedIntArray(int size) throws IOException {
        Integer[] array = new Integer[size];

        for (int index = 0; index < size; ++index) {
            array[index] = readInt();
        }
        Arrays.sort(array);

        int[] sortedArray = new int[size];
        for (int index = 0; index < size; ++index) {
            sortedArray[index] = array[index];
        }

        return sortedArray;
    }

    int[] sortedIntArray(int size, int[] array) throws IOException {
        for (int index = 0; index < size; ++index) {
            array[index] = readInt();
        }
        Arrays.sort(array);

        int[] sortedArray = new int[size];
        for (int index = 0; index < size; ++index) {
            sortedArray[index] = array[index];
        }

        return sortedArray;
    }

    int minInt(int... values) {
        int min = Integer.MAX_VALUE;
        for (int value : values) {
            min = Math.min(min, value);
        }
        return min;
    }

    int maxInt(int... values) {
        int max = Integer.MIN_VALUE;
        for (int value : values) {
            max = Math.max(max, value);
        }
        return max;
    }

    long minLong(long... values) {
        long min = Long.MAX_VALUE;
        for (long value : values) {
            min = Math.min(min, value);
        }
        return min;
    }

    long maxLong(long... values) {
        long max = Long.MIN_VALUE;
        for (long value : values) {
            max = Math.max(max, value);
        }
        return max;
    }

    boolean checkIndex(int index, int size) {
        return (0 <= index && index < size);
    }

    int abs(int a) {
        return Math.abs(a);
    }
}