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.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;


public class Main {

	static boolean visited[] ; 
	static boolean ends[] ;
	static long mod = 1000000007 ;
	static int lens[] ; 
	static int seeds[] ; 
	static char a[] ;
	static double total ; 
	public static ArrayList adj[] ; 
	public static long x,y ;
	public static ArrayList<Long> xx ;	
	public static double dp[][][] ;
	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc =  new Scanner(System.in) ;


		int n = sc.nextInt() ; 
		if(n%4==0 || n%4==3)
			System.out.println(0);
		else
			System.out.println(1);


		System.out.print((int)Math.ceil((1.0*n)/2)+" ");
		int arr[] = new int[n+1] ; 
		for (int i = 0; i < n+1; i++)
		{
			arr[i]=n-i ;
		}
		int nn = n/4 ; 

		for (int j = 0,i=0; j < nn; j++)
		{

			System.out.print(arr[i]+" ");
			System.out.print(arr[i+3]+" ");
			i+=4 ;
		}
		nn=n%4 ; 
		if(nn ==1)System.out.println(1); 
		if(nn==2)System.out.println(2);
		if(nn==3)System.out.println("2 1");

		return ;
	}


	static long pow(long base, int exp) {
		long res = 1;
		while(exp > 0) {
			if(exp % 2 == 1) {
				res = (res * base) % mod;
			}

			base = (base * base) % mod;
			exp /= 2;
		}

		return res;
	}
































	public static void dfss(int root , int len)
	{
		visited[root]=true ; 
		if(ends[root] && root!=0) lens[root] = len ; 

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c= (int) adj[root].get(i) ; 
			if(visited[c]==false)
				dfss(c, len+1);
		}
	}

	public static void pr(int root ,  int seed){
		visited[root] = true ;
		int dv = adj[root].size()-1 ; 
		if(root==0) dv++ ;

		for (int i = 0; i < adj[root].size(); i++)
		{
			int c = (int)adj[root].get(i) ; 
			seeds[c]=dv*seed ;
		}

		for (int i = 0; i < adj[root].size() ; i++)
		{
			int c = (int)adj[root].get(i) ; 
			if(visited[c]==false)
				pr(c , seeds[c]);

		}

	}



	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

		public boolean ready() throws IOException {
			return br.ready();
		}
	}


	public static long getGCD(long n1, long n2) {
		if (n2 == 0) {
			return n1;
		}
		return getGCD(n2, n1 % n2);
	}


	public static void shuffle(ArrayList<Integer> ss){
		if(ss.size()==1)
			return ; 
		for (int i = 0; i < ss.size(); i++)
		{
			Random rand = new Random();

			int  n = rand.nextInt(ss.size()-1) + 0;

			int tmp = ss.get(n);
			ss.remove(n);
			ss.add(tmp);
		}
	}
	//	public static int binary(ArrayList<pair> arr, int l, int r, long x)   /// begin by 0 and n-1
	//	{
	//		if (r>=l)
	//		{
	//			int mid = l + (r - l)/2;
	//			if (arr.get(mid).x== x)
	//				return mid;
	//			if (arr.get(mid).x> x)
	//				return binary(arr, l, mid-1, x);
	//			return binary(arr, mid+1, r, x);
	//		}
	//		return -1;
	//	}

	/// searching for the index of first elment greater than x
	public static int binary1(int[]arr , int x) {
		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size() 
		while (low != high) {
			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
			if (arr[mid] <= x) {
				/* This index, and everything below it, must not be the first element
				 * greater than what we're looking for because this element is no greater
				 * than the element.
				 */
				low = mid + 1;
			}
			else {
				/* This element is at least as large as the element, so anything after it can't
				 * be the first element that's at least as large.
				 */
				high = mid;
			}
		}
		return low ; // return high ; 
	}


	////// searching for last element less than X 
	//	public static int binary2(pair[]arr , int x) {
	//		int low = 0, high = arr.length; // numElems is the size of the array i.e arr.size() 
	//		while (low != high) {
	//			int mid = (low + high) / 2; // Or a fancy way to avoid int overflow
	//			if (arr[mid].x >= x) {
	//				/* This index, and everything below it, must not be the first element
	//				 * greater than what we're looking for because this element is no greater
	//				 * than the element.
	//				 */
	//				high=mid;
	//			}
	//			else {
	//				/* This element is at least as large as the element, so anything after it can't
	//				 * be the first element that's at least as large.
	//				 */
	//				low = mid+1 ; 
	//			}
	//		}
	//		return low ; // return high ; 
	//	}







	public static int binary(long []arr , long target , int low , long shift) {
		int high = arr.length; 
		while (low != high) {
			int mid = (low + high) / 2; 
			if (arr[mid]-shift <= target) {
				low = mid + 1;
			}
			else {
				high = mid;
			}
		}
		return low ; // return high ; 
	}
	public static boolean isLetter(char x){
		if(x+0 <=122 && x+0 >=97 )
			return true ;
		else if (x+0 <=90 && x+0 >=65 )
			return true ; 
		else return false; 
	}
	public static long getPrimes(long x ){
		if(x==2 || x==3 || x==1)
			return 2 ;
		if(isPrime(x))
			return 5 ;
		for (int i = 2; i*i<=x; i++)
		{
			if(x%i==0 && isPrime(i))
				return getPrimes(x/i) ;
		}
		return -1;
	}







	public static int lis( int[]a , int n){
		int lis[] = new int[n] ; 
		Arrays.fill(lis,1) ; 

		for(int i=1;i<n;i++)
			for(int j=0 ; j<i; j++)
				if (a[i]>a[j] &&  lis[i] < lis[j]+1)   
					lis[i] = lis[j] + 1;           

		int max = lis[0];

		for(int i=1; i<n ; i++)
			if (max < lis[i])
				max = lis[i] ;
		return (max);

		//			ArrayList<Integer> s = new ArrayList<Integer>() ;
		//			for (int i = n-1; i >=0; i--)
		//			{
		//				if(lis[i]==max)
		//				{
		//					s.add(a[i].z);
		//					max --; 
		//				}
		//			}
		//
		//			for (int i = s.size()-1 ; i>=0 ;  i--)
		//			{
		//				System.out.print(s.get(i)+" ");
		//			}
		//
	}
	public static int calcDepth(Vertix node){
		if(node.depth>0) return node.depth; 
		// meaning it has been updated before;
		if(node.parent != null)
			return 1+ calcDepth(node.parent);
		else
			return -1;
	}

	public static boolean isPrime (long num){
		if (num < 2) return false;
		if (num == 2) return true;
		if (num % 2 == 0) return false;
		for (int i = 3; i * i <= num; i += 2)
			if (num % i == 0) return false;
		return true;
	}


	public static ArrayList<Long> getDiv(Long n)
	{
		ArrayList<Long>  f = new ArrayList<Long>() ; 

		while (n%2==0)
		{
			if(!f.contains(2))f.add((long) 2) ;
			n /= 2;
		}

		// n must be odd at this point.  So we can
		// skip one element (Note i = i +2)
		for (long i = 3; i <= Math.sqrt(n); i+= 2)
		{
			// While i divides n, print i and divide n
			while (n%i == 0)
			{
				if(!f.contains(i))f.add(i);
				n /= i;
			}
		}

		// This condition is to handle the case whien
		// n is a prime number greater than 2
		if (n > 2)
			if(!f.contains(n))f.add(n);


		return f ;



	}

	//		public static boolean dfs(Vertix v , int target){
	//			try{
	//				visited[v.i]= true ;
	//			} catch (NullPointerException e)
	//			{
	//				System.out.println(v.i);
	//			}
	//			if(v.i == target)
	//
	//				return true ;
	//			for (int i =0 ; i< v.neighbours.size() ; i++)
	//			{ 
	//
	//				Vertix child = v.neighbours.get(i) ;
	//				if(child.i == target){
	//					found = true  ; 
	//				}
	//				if(visited[child.i]==false){
	//					found |= dfs(child, target) ;
	//				}
	//			}
	//			return found; 
	//		}









	public static class Vertix{
		long i ; 
		int depth ;
		ArrayList<Vertix> neighbours ; 
		Vertix parent ; 
		Vertix child ; 


		public Vertix(long i){
			this.i = i ;
			this.neighbours = new ArrayList<Vertix> () ;
			this.parent = null ;
			depth =-1;
			this.child = null ;
		}
	}

	public static class pair implements Comparable<pair> {
		long x ; 
		int y ; 




		public pair(long x, int y ){

			this.x=x ; 
			this.y =y ;


		}


		@Override
		public int compareTo(pair p) {
			if(this.x > p.x)
				return 1 ; 
			else if (this.x == p.x) 
				return 0 ; 
			else 
				return -1 ;
		}




	}

	public static class pair2 implements Comparable<pair2>{
		int i ; 
		int j ;
		int plus ;

		public pair2(int i , int j , int plus){
			this.i =i ;
			this.j = j ; 
			this.plus = plus ;
		}

		@Override
		public int compareTo(pair2 p) {
			if(this.j > p.j)
				return 1 ; 
			else if (this.j == p.j) return 0 ;
			else 
				return -1 ;
		}


	}
	public static class point implements  Comparable<point>
	{
		int x, y ; 
		public point(int x,int y){
			this.x=x ; this.y=y;
		}
		@Override
		public boolean equals(Object o) {

			// If the object is compared with itself then return true  
			if (o == this) {
				return true;
			}

			/* Check if o is an instance of Complex or not
	          "null instanceof [type]" also returns false */
			if (!(o instanceof point)) {
				return false;
			}

			// typecast o to Complex so that we can compare data members 
			point c = (point) o;

			// Compare the data members and return accordingly 
			return Integer.compare(x, c.x) == 0
					&& Integer.compare(y, c.y) == 0;
		}
		@Override
		public int compareTo(point p) {
			if(this.x == p.x && this.y ==p.y)
				return 0 ; 
			else
				return -1 ; 
		}

		@Override
		public int hashCode()
		{
			return 15+x+(y%2) ;
		}



	}


}