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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;


public class E {
	
	static final long MOD=998244353;

	static int[] minSubtreeSumOfSize=new int[2_000_000];
	static int[][] dp=new int[10000][2];
	
	public static void main(String[] args) {
		precomp();
		for (int i=0; i<dp.length; i++) Arrays.fill(dp[i], -1);
		for (int i=0; i<400; i++) {
			int ways=go(i, true, true);
			ways+=go(i, false, true);
//			if (ways!=0) System.out.println(i);
//			System.out.println(i+": "+ways);
		}
		FastScanner fs=new FastScanner();
//		int nNodes=fs.nextInt();
		boolean[] works=new boolean[2_000_000];
		int cur=1;
		while (cur<works.length) {
			works[cur]=true;
			cur++;
			if (cur<works.length) works[cur]=true;
			cur*=2;
			if (cur<works.length) works[cur]=true;
			cur++;
			if (cur<works.length) works[cur]=true;
			cur=cur*2-1;
			if (cur<works.length) works[cur]=true;
		}
		System.out.println(works[fs.nextInt()]?1:0);
	}
	
	static int go(int nNodes, boolean rootOdd, boolean lowestOdd) {
		if (nNodes==0) return 1;
		if (nNodes==1) {
			if (rootOdd==lowestOdd) return 1;
			else return 0;
		}
		if (dp[nNodes][(rootOdd^lowestOdd)?1:0]!=-1) return dp[nNodes][(rootOdd^lowestOdd)?1:0];
		long total=0;
		for (int toGiveLeft=0; toGiveLeft<nNodes; toGiveLeft++) {
			//make sure this leaves the root the right pairity
			if ((lowestOdd==rootOdd) ^ (toGiveLeft%2==0) )  {
				continue;
			}
			
			int rightSize=nNodes-toGiveLeft-1;
			//make sure this would leave the tree balanced
			if (minSubtreeSumOfSize[toGiveLeft]+toGiveLeft+minSubtreeSumOfSize[rightSize]+rightSize != minSubtreeSumOfSize[nNodes])  {
				continue;
			}
			
			long leftWays=go(toGiveLeft, rootOdd^true, lowestOdd);
			boolean rightOdd=lowestOdd^(toGiveLeft%2!=0)^true;
			long rightWays=go(rightSize, rootOdd, rightOdd);
			total+=leftWays*rightWays%MOD;
		}
		return dp[nNodes][(rootOdd^lowestOdd)?1:0]=(int)(total%MOD);
	}
	
	static void precomp() {
		for (int i=1; i<minSubtreeSumOfSize.length; i++)
			minSubtreeSumOfSize[i]=minSubtreeSumOfSize[i-1]+Integer.numberOfTrailingZeros(Integer.highestOneBit(i));
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
	
}