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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.invoke.MethodHandles;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        parseAndGenerate();
        try (PrintWriter out = new PrintWriter(System.out)) {
            FastScanner scanner = new FastScanner();
            int n = scanner.nextInt();
            if (n == 2) {
                out.println(1);
                out.print(1 + " " + 1);
            } else if (n == 3) {
                out.println(0);
                out.print(2 + " " + 1 + " " + 2);
            } else if (n % 2 == 0) {
                List<Integer> first = new ArrayList<>(), second = new ArrayList<>();
                int i = 1, j = n;
                while (i < j) {
                    first.add(i);
                    first.add(j);
                    i++;
                    j--;
                    if (i <= n / 2) {
                        second.add(i);
                        second.add(j);
                        i++;
                        j--;
                    }
                }
                if (first.size() == second.size()) {
                    out.println(0);
                    out.print(first.size() + " ");
                    for (int num : first) {
                        out.print(num + " ");
                    }
                    out.println();
                } else {
                    out.println(1);
                    second.add(first.get(first.size() - 1));
                    first.remove(first.size() - 1);
                    out.print(first.size() + " ");
                    for (int num : first) {
                        out.print(num + " ");
                    }
                    out.println();
                }
            } else {
                List<Integer> first = new ArrayList<>(), second = new ArrayList<>();
                int i = 2, j = n;
                while (i < j) {
                    first.add(i);
                    first.add(j);
                    i++;
                    j--;
                    if (i < j) {
                        second.add(i);
                        second.add(j);
                        i++;
                        j--;
                    }
                }
                if (first.size() == second.size()) {
                    out.println(1);
                    first.add(1);
                    out.print(first.size() + " ");
                    for (int num : first) {
                        out.print(num + " ");
                    }
                    out.println();
                } else {
                    out.println(0);
                    second.add(first.get(first.size() - 1));
                    first.remove(first.size() - 1);
                    first.add(1);
                    out.print(first.size() + " ");
                    for (int num : first) {
                        out.print(num + " ");
                    }
                    out.println();
                }
            }
        }
    }

    static final Random random = new Random();

    static void ruffleSort(long[] a) {
        // shuffle, then sort
        int n = a.length;
        for (int i = 0; i < n; i++) {
            int oi = random.nextInt(n);
            long temp = a[oi];
            a[oi] = a[i];
            a[i] = temp;
        }
        Arrays.sort(a);
    }

    static class FastScanner {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long[] readArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        Integer[] readArrayInt(int n) {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

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

    static class Pair {

        int first;

        int second;

        public Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (o == null || getClass() != o.getClass()) {
                return false;
            }
            Pair pair = (Pair) o;
            return first == pair.first && second == pair.second;
        }

        @Override
        public int hashCode() {
            return Objects.hash(first, second);
        }
    }

    static class Equation {

        // ax+by=c;
        int a, b, c;

        public Equation(int x1, int y1, int x2, int y2) {
            int a = y2 - y1;
            int b = x1 - x2;
            int c = a * x1 + b * y1;
        }

        public Equation(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public boolean isPointOnLine(int x, int y) {
            return a * x + b * y == c;
        }
    }

    private static void buildGraph(HashMap<Integer, Set<Integer>> map, int first, int second) {
        Set<Integer> set = map.getOrDefault(first, new HashSet<>());
        set.add(second);
        map.put(first, set);
        set = map.getOrDefault(second, new HashSet<>());
        set.add(first);
    }

    public static void parseAndGenerate() {
    }

    private static void print2dArr(PrintWriter out, int[][] arr) {
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                out.print(arr[i][j] + " ");
            }
            out.println();
        }
    }

    private static boolean[] sieve(int n) {
        boolean[] isPrime = new boolean[n + 1];
        Arrays.fill(isPrime, true);
        isPrime[0] = isPrime[1] = false;
        for (int i = 2; i <= n; i++) {
            if (isPrime[i] && ((long) i * i) <= n) {
                for (int j = i * i; j <= n; j += i) {
                    isPrime[j] = false;
                }
            }
        }
        return isPrime;
    }
}
