Problem: Recall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left subtree, and less than any key stored in the right subtree.

The depth of a vertex is the number of edges on the simple path from the vertex to the root. In particular, the depth of the root is 0.

Let's call a binary search tree perfectly balanced if there doesn't exist a binary search tree with the same number of vertices that has a strictly smaller sum of depths of its vertices.

Let's call a binary search tree with integer keys striped if both of the following conditions are satisfied for every vertex v: 

  * If v has a left subtree whose root is u, then the parity of the key of v is different from the parity of the key of u. 
  * If v has a right subtree whose root is w, then the parity of the key of v is the same as the parity of the key of w. 



You are given a single integer n. Find the number of perfectly balanced striped binary search trees with n vertices that have distinct integer keys between 1 and n, inclusive. Output this number modulo 998 244 353.

Input

The only line contains a single integer n (1 ≤ n ≤ 10^6), denoting the required number of vertices.

Output

Output the number of perfectly balanced striped binary search trees with n vertices and distinct integer keys between 1 and n, inclusive, modulo 998 244 353.

Examples

Input


4


Output


1


Input


3


Output


0

Note

In the first example, this is the only tree that satisfies the conditions: <image>

In the second example, here are various trees that don't satisfy some condition: <image>

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

public class E implements Runnable {
	public static void main (String[] args) {new Thread(null, new E(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("");

		//answer's always tiny?
		int n = fs.nextInt();
		long res = 0;
		int md = (1+n)/2;
		if(n % 2 == 1) {
			res = mult(solve(1,md-1, 0), solve(md+1, n, 1));
		}
		else {
			
			long r1 = 0, r2 = 0;
			if(md % 2 == 1) {
				r1 = mult(solve(1, md-1, 0), solve(md+1, n, 1));
				r2 = mult(solve(1, md, 1), solve(md+2, n, 0));
			}
			else {
				r1 = mult(solve(1, md-1, 1), solve(md+1, n, 0));
				r2 = mult(solve(1, md, 0), solve(md+2, n, 1));
			}
			
			r1 += r2;
			r1 %= MOD;
			res = r1;
		}
		
		out.println(res);
		
		out.close();
	}
	
	long solve(int L, int R, int reqPar) {
		if(R < L) return 1;
		if(L == R) {
			if((L&1) != reqPar) return 0;
			return 1;
		}
		int len = R-L+1;
		int mid = (L+R)/2;
		if((len&1) == 1) {
			if((mid&1) != reqPar) return 0;
			long ret1 = solve(L, mid-1, (mid&1)^1);
			long ret2 = solve(mid+1, R, (mid & 1));
			return mult(ret1, ret2);
		}
		else {
			
			if((mid&1) == reqPar) {
				long ret1 = solve(L, mid-1, (mid&1)^1);
				long ret2 = solve(mid+1, R, (mid & 1));
				return mult(ret1, ret2);
			}
			else {
				long ret1 = solve(L, mid, reqPar^1);
				long ret2 = solve(mid+2, R, reqPar);
				return mult(ret1, ret2);
			}
		}
	}
	
	long MOD = 998244353;
	long mult(long a, long b) {
		a *= b;
		if(a >= MOD) a %= MOD;
		return a;
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) {
			try {
				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
			}
			catch (Exception e) {
				in = new BufferedInputStream(System.in, BS);
			}
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}