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 Newbie {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        solver s = new solver();
        long t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

   /* static class descend implements Comparator<pair1> {
        public int compare(pair1 o1, pair1 o2) {
            if (o1.pop != o2.pop)
                return (int) (o1.pop - o2.pop);
            else
                return o1.in - o2.in;
        }
    }*/

    static class InputReader {
        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String next() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    static class card {
        long a;
        int cnt;
        int i;

        public card(long a, int cnt, int i) {
            this.a = a;
            this.cnt = cnt;
            this.i = i;
        }
    }

    static class ascend implements Comparator<pair> {
        public int compare(pair o1, pair o2) {
            if (o1.b != o2.b)
                return o1.b - o2.b;
            else
                return o1.a - o2.a;
        }
    }

    static class extra {

        static boolean v[] = new boolean[100001];
        static List<Integer> l = new ArrayList<>();
        static int t;

        static void shuffle(long a[]) {
            List<Long> l = new ArrayList<>();
            for (int i = 0; i < a.length; i++)
                l.add(a[i]);
            Collections.shuffle(l);
            for (int i = 0; i < a.length; i++)
                a[i] = l.get(i);
        }

        static int gcd(int a, int b) {
            if (b == 0)
                return a;
            else
                return gcd(b, a % b);
        }

        static boolean valid(int i, int j, int r, int c, char ch[][]) {
            if (i >= 0 && i < r && j >= 0 && j < c && ch[i][j] != '#') {
                // System.out.println(i+" /// "+j);
                return true;
            } else {
                //  System.out.println(i+" //f "+j);
                return false;
            }
        }

        static void seive() {
            for (int i = 2; i < 100001; i++) {
                if (!v[i]) {
                    t++;
                    l.add(i);
                    for (int j = 2 * i; j < 100001; j += i)
                        v[j] = true;
                }
            }
        }

        static int binary(LinkedList<Integer> a, long val, int n) {
            int mid = 0, l = 0, r = n - 1, ans = 0;
            while (l <= r) {
                mid = (l + r) >> 1;
                if (a.get(mid) == val) {
                    r = mid - 1;
                    ans = mid;
                } else if (a.get(mid) > val)
                    r = mid - 1;
                else {
                    l = mid + 1;
                    ans = l;
                }
            }
            return (ans + 1);
        }

        static long fastexpo(int x, int y) {
            long res = 1;
            while (y > 0) {
                if ((y & 1) == 1) {
                    res *= x;
                }
                y = y >> 1;
                x = x * x;
            }
            return res;
        }

        static long lfastexpo(int x, int y, int p) {
            long res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) == 1) {
                    res = (res * x) % p;
                }
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

        void dijsktra(int s, List<pair> l[], int n) {
            PriorityQueue<pair> pq = new PriorityQueue<>(new ascend());
            int dist[] = new int[100005];
            boolean v[] = new boolean[100005];
            for (int i = 1; i <= n; i++)
                dist[i] = 1000000000;
            dist[s] = 0;
            for (int i = 1; i < n; i++) {
                if (i == s)
                    pq.add(new pair(s, 0));
                else
                    pq.add(new pair(i, 1000000000));
            }
            while (!pq.isEmpty()) {
                pair node = pq.remove();
                v[node.a] = true;
                for (int i = 0; i < l[node.a].size(); i++) {
                    int v1 = l[node.a].get(i).a;
                    int w = l[node.a].get(i).b;
                    if (v[v1])
                        continue;
                    if ((dist[node.a] + w) < dist[v1]) {
                        dist[v1] = dist[node.a] + w;
                        pq.add(new pair(v1, dist[v1]));
                    }
                }
            }
        }
    }

    static class pair {
        int a;
        int b;

        public pair(int a, int i) {
            this.a = a;
            this.b = i;
        }
    }

    static class pair1 {
        pair p;
        int in;

        public pair1(pair a, int n) {
            this.p = a;
            this.in = n;
        }
    }


    static int inf = (int) 1e9 + 7;

    static class solver {
        void solve() {
            int n = sc.nextInt();
            if (n % 4 == 0) {
                System.out.println(0);
                System.out.print(n / 2 + " ");
                for (int i = 1; i <= n; i++) {
                    if (i % 4 == 0 || i % 4 == 1)
                        System.out.print(i + " ");
                }
                System.out.println();
            } else if (n % 4 == 2) {
                System.out.println(1);
                System.out.print(n / 2 + " ");
                for (int i = 1; i <= n; i++) {
                    if (i % 4 == 0 || i % 4 == 1)
                        System.out.print(i + " ");
                }
                System.out.println();
            } else if (n % 4 == 3) {
                System.out.println(0);
                List<Integer> l1 = new ArrayList<>();
                for (int i = 1; i <= n / 4; i++)
                    l1.add(i);
                for (int i = (n - n / 4); i <= n; i++)
                    l1.add(i);
                System.out.print(l1.size() + " ");
                l1.forEach(n1 -> System.out.print(n1 + " "));
            } else {
                System.out.println(1);
                List<Integer> l1 = new ArrayList<>();
                for (int i = 1; i <= (n / 4 + 1); i++)
                    l1.add(i);
                for (int i = (n - n / 4 + 1); i <= n; i++)
                    l1.add(i);
                System.out.print(l1.size() + " ");
                l1.forEach(n1 -> System.out.print(n1 + " "));
            }
        }
    }
}
