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;
mt19937 rng(static_cast<unsigned int>(
    chrono::steady_clock::now().time_since_epoch().count()));
template <typename num_t>
inline void add_mod(num_t& a, const long long& b, const int& m) {
  a = (a + b) % m;
  if (a >= m) a -= m;
  if (a < 0) a += m;
}
template <typename num_t>
inline bool update_max(num_t& a, const num_t& b) {
  return a < b ? a = b, true : false;
}
template <typename num_t>
inline bool update_min(num_t& a, const num_t& b) {
  return a > b ? a = b, true : false;
}
template <typename num_t>
num_t gcd(num_t lhs, num_t rhs) {
  return !lhs ? rhs : gcd(rhs % lhs, lhs);
}
template <typename num_t>
num_t pw(num_t n, num_t k, const num_t& mod) {
  if (k == -1) k = mod - 2;
  num_t res = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) res = 1ll * res * n % mod;
    n = 1ll * n * n % mod;
  }
  return res % mod;
}
const int inf = 1e9 + 7;
const int mod = 998244353;
const long long ll_inf = (long long)inf * inf + 7;
const int maxn = 1000000 + 7;
struct InverseModule {
  static const int MOD = ::mod;
  static const int MAX_N = 1e6 + 7;
  int fact[MAX_N];
  int inv_fact[MAX_N];
  InverseModule() {
    fact[0] = 1;
    for (int i = 1; i < MAX_N; ++i) {
      fact[i] = (long long)fact[i - 1] * i % MOD;
    }
    inv_fact[MAX_N - 1] = inverse(fact[MAX_N - 1]);
    for (int i = MAX_N - 2; i >= 0; --i) {
      inv_fact[i] = (long long)inv_fact[i + 1] * (i + 1) % MOD;
    }
  }
  int inverse(int x, int mod = MOD) {
    int r = mod, newr = x;
    int t = 0, newt = 1;
    while (newr > 0) {
      int q = r / newr;
      int tmp = newr;
      newr = r % newr;
      r = tmp;
      tmp = newt;
      newt = t - q * newt;
      t = tmp;
    }
    if (t < 0) t += mod;
    return t;
  }
  int choose(int n, int k) {
    return (long long)fact[n] * inv_fact[n - k] % MOD * inv_fact[k] % MOD;
  }
  int perm(int n, int k) { return (long long)fact[n] * inv_fact[n - k] % MOD; }
  long long pw(long long x, long long k, const long long& mod = MOD) {
    long long res = 1 % mod;
    for (; k > 0; k >>= 1) {
      if (k & 1) res = res * x % mod;
      x = x * x % mod;
    }
    return res;
  }
  pair<int, int> extended_euclid(int a, int b) {
    int s0 = 1, t0 = 0;
    int s1 = 0, t1 = 1;
    while (b > 0) {
      int q = a / b;
      int tmp = 0;
      tmp = s1;
      s1 = s0 - q * s1;
      s0 = tmp;
      tmp = t1;
      t1 = t0 - q * t1;
      t0 = tmp;
      tmp = b;
      b = a - q * b;
      a = tmp;
    }
    return {s0, t0};
  }
  int stirling_second_kind(int n, int k) {
    long long res = 0;
    for (int j = 0; j <= k; ++j) {
      long long temp = 1ll * choose(k, j) * pw(j, n);
      if ((k - j) & 1)
        res = (res - temp + MOD) % MOD;
      else
        res = (res + temp) % MOD;
    }
    return res * inv_fact[k] % MOD;
  }
} inv;
long long dp[2][maxn];
void solve() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << 1;
    return;
  }
  if (n == 2) {
    cout << 1;
    return;
  }
  int a = 4, b = 5;
  while (b < n) {
    int nxt = a + b;
    if (a & 1) ++nxt;
    a = nxt;
    b = a + 1;
  }
  cerr << "a"
       << ": " << (a) << ", "
       << "b"
       << ": " << (b) << '\n';
  ;
  if (n == a || n == b)
    cout << 1;
  else
    cout << 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}