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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool ckmn(T &a, T b) {
  T c = a;
  a = min(a, b);
  return a != c;
}
template <typename T>
bool ckmx(T &a, T b) {
  T c = a;
  a = max(a, b);
  return a != c;
}
const int mod = 998244353;
int mul(int x, int y) { return (long long)x * y % mod; }
int add(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
int sub(int x, int y) {
  x -= y;
  return x < 0 ? x + mod : x;
}
int powmod(int x, int k) {
  int ans = 1;
  for (; k; k >>= 1, x = mul(x, x))
    if (k & 1) ans = mul(ans, x);
  return ans;
}
int mul_inv(int x) { return powmod(x, mod - 2); }
void fft(int a[], int n, bool inv) {
  for (int i = 1, j = 0; i < n; i++) {
    int k = n;
    do j ^= k >>= 1;
    while (~j & k);
    if (j > i) swap(a[i], a[j]);
  }
  for (int j = 2; j <= n; j <<= 1) {
    int ang = powmod(3, (mod - 1) / j);
    if (inv) ang = mul_inv(ang);
    for (int i = 0; i < n / j; i++) {
      int cur = 1;
      for (int k = i * j; k < i * j + j / 2; k++) {
        int tmp = mul(cur, a[k + j / 2]);
        a[k + j / 2] = sub(a[k], tmp);
        a[k] = add(a[k], tmp);
        cur = mul(cur, ang);
      }
    }
  }
  int m = mul_inv(n);
  if (inv)
    for (int i = 0; i < n; i++) a[i] = mul(a[i], m);
}
const int N = 2000050;
int dp[2][N], par[N], nepar[N];
int main() {
  int n, i;
  scanf("%i", &n);
  dp[1][0] = 1;
  dp[0][1] = 1;
  i = 1;
  for (i = 2; i * 2 - 1 <= n; i *= 2) {
    for (int j = 0; j < i * 2; j++) par[j] = (j % 2 == 0 ? dp[1][j] : 0);
    for (int j = 0; j < i * 2; j++) nepar[j] = (j % 2 == 1 ? dp[0][j] : 0);
    fft(dp[0], i * 2, 0);
    fft(dp[1], i * 2, 0);
    fft(par, i * 2, 0);
    fft(nepar, i * 2, 0);
    for (int j = 0; j < i * 2; j++) dp[1][j] = mul(dp[0][j], nepar[j]);
    for (int j = 0; j < i * 2; j++) dp[0][j] = mul(dp[0][j], par[j]);
    fft(dp[0], i * 2, 1);
    fft(dp[1], i * 2, 1);
  }
  n -= i - 1;
  printf("%i\n", add(dp[0][n], dp[1][n]));
  return 0;
}