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>
#pragma GCC optimize("-O2")
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void Out(long long x) {
  if (x > 9) Out(x / 10);
  putchar(x % 10 + '0');
}
long long qpow(long long x, long long y, long long P) {
  long long re = 1;
  while (y) {
    if (y & 1) re = re * x % P;
    x = x * x % P;
    y >>= 1;
  }
  return re;
}
int top = 0;
int q[10005];
long long GEN(long long x) {
  bool flag;
  long long y = x - 1;
  for (long long i = 2; i <= y; ++i)
    if (y % i == 0) {
      q[++top] = i;
      while (y % i == 0) y /= i;
    }
  for (long long i = 2;; ++i) {
    flag = 0;
    for (long long j = 1; j <= top; ++j)
      if (qpow(i, (x - 1) / q[j], x) == 1) {
        flag = 1;
        break;
      }
    if (!flag) return i;
  }
}
const int N = (1 << 20) + 10;
const long long mod = 998244353;
int rev[N];
struct NTT {
  int n;
  long long g;
  void init(int m) {
    g = 3;
    n = 1;
    int k = 0;
    while (n < m) {
      n <<= 1;
      ++k;
    }
    for (int i = 0; i < n; ++i) {
      int t = 0;
      for (int j = 0; j < k; ++j)
        if (i & (1 << j)) t |= (1 << (k - j - 1));
      rev[i] = t;
    }
  }
  void DFT(long long *a, int flag) {
    for (int i = 0; i < n; ++i)
      if (rev[i] > i) swap(a[i], a[rev[i]]);
    for (int l = 2; l <= n; l <<= 1) {
      int m = l >> 1;
      long long wn =
          qpow(g, flag == 1 ? (mod - 1) / l : mod - 1 - (mod - 1) / l, mod);
      for (long long *p = a; p != a + n; p += l) {
        long long w = 1;
        for (int k = 0; k < m; ++k) {
          long long t = w * p[k + m] % mod;
          p[k + m] = (p[k] - t + mod) % mod;
          p[k] = (p[k] + t) % mod;
          w = w * wn % mod;
        }
      }
    }
    if (flag == -1) {
      long long ppp = qpow(n, mod - 2, mod);
      for (int i = 0; i < n; ++i) a[i] = a[i] * ppp % mod;
    }
  }
  void Cheng(long long *a, long long *b, int m) {
    init(m);
    DFT(a, 1);
    DFT(b, 1);
    for (int i = 0; i < n; ++i) a[i] = a[i] * b[i] % mod;
    DFT(a, -1);
  }
} ntt;
long long A[N], B[N], C[N];
long long f[2][2][N];
int n, M, X, S, g;
int main() {
  int a = 1, b = 2, c, d;
  cin >> n;
  if (n == a || n == b) {
    cout << 1 << endl;
    return 0;
  }
  while (a < n) {
    a = b * 2;
    b = a + 1;
    if (n == a || n == b) {
      cout << 1 << endl;
      return 0;
    }
    a = a + b;
    b = a + 1;
    if (n == a || n == b) {
      cout << 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}