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>
template <class T>
inline void Swap(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
const int N = 3e6 + 5, rqy = 998244353;
int n, m, ups, rst, rev[N], yg[N], f[N], g[N], t1[N], t2[N], t3[N];
int qpow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = 1ll * res * a % rqy;
    a = 1ll * a * a % rqy;
    b >>= 1;
  }
  return res;
}
void FFT(int n, int *a, int op) {
  for (int i = 0; i < n; i++)
    if (i < rev[i]) Swap(a[i], a[rev[i]]);
  yg[n] = qpow(3, (rqy - 1) / n * ((n + op) % n));
  for (int i = n >> 1; i; i >>= 1) yg[i] = 1ll * yg[i << 1] * yg[i << 1] % rqy;
  for (int k = 1; k < n; k <<= 1) {
    int x = yg[k << 1];
    for (int i = 0; i < n; i += k << 1) {
      int w = 1;
      for (int j = 0; j < k; j++) {
        int u = a[i + j], v = 1ll * w * a[i + j + k] % rqy;
        a[i + j] = (u + v) % rqy;
        a[i + j + k] = (u - v + rqy) % rqy;
        w = 1ll * w * x % rqy;
      }
    }
  }
  if (op == -1) {
    int gg = qpow(n, rqy - 2);
    for (int i = 0; i < n; i++) a[i] = 1ll * a[i] * gg % rqy;
  }
}
int main() {
  std::cin >> n;
  m = ups = 1;
  while (ups * 2 + 1 <= n) m++, ups = ups * 2 + 1;
  rst = n - ups;
  f[0] = g[1] = 1;
  for (int T = 2; T <= m; T++) {
    int len = 1 << T;
    for (int i = 0; i < len; i++)
      rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << T - 1);
    for (int i = 0; i < (1 << T - 1); i++)
      if (i & 1)
        t2[i] = g[i], t1[i] = 0;
      else
        t1[i] = f[i], t2[i] = 0;
    for (int i = 0; i < (1 << T - 1); i++) t3[i] = g[i];
    FFT(len, t1, 1);
    FFT(len, t2, 1);
    FFT(len, t3, 1);
    for (int i = 0; i < len; i++)
      g[i] = 1ll * t1[i] * t3[i] % rqy, f[i] = 1ll * t2[i] * t3[i] % rqy;
    FFT(len, f, -1);
    FFT(len, g, -1);
  }
  return std::cout << (f[rst] + g[rst]) % rqy << std::endl, 0;
}