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 <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p) {
  return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc) {
  o << "{";
  for (const T& v : vc) o << v << ",";
  o << "}";
  return o;
}
using ll = long long;
template <class T>
using V = vector<T>;
template <class T>
using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
template <unsigned int mod_>
struct ModInt {
  using uint = unsigned int;
  using ll = long long;
  using ull = unsigned long long;
  constexpr static uint mod = mod_;
  uint v;
  ModInt() : v(0) {}
  ModInt(ll _v) : v(normS(_v % mod + mod)) {}
  explicit operator bool() const { return v != 0; }
  static uint normS(const uint& x) { return (x < mod) ? x : x - mod; }
  static ModInt make(const uint& x) {
    ModInt m;
    m.v = x;
    return m;
  }
  ModInt operator+(const ModInt& b) const { return make(normS(v + b.v)); }
  ModInt operator-(const ModInt& b) const { return make(normS(v + mod - b.v)); }
  ModInt operator-() const { return make(normS(mod - v)); }
  ModInt operator*(const ModInt& b) const { return make((ull)v * b.v % mod); }
  ModInt operator/(const ModInt& b) const { return *this * b.inv(); }
  ModInt& operator+=(const ModInt& b) { return *this = *this + b; }
  ModInt& operator-=(const ModInt& b) { return *this = *this - b; }
  ModInt& operator*=(const ModInt& b) { return *this = *this * b; }
  ModInt& operator/=(const ModInt& b) { return *this = *this / b; }
  ModInt& operator++(int) { return *this = *this + 1; }
  ModInt& operator--(int) { return *this = *this - 1; }
  ll extgcd(ll a, ll b, ll& x, ll& y) const {
    ll p[] = {a, 1, 0}, q[] = {b, 0, 1};
    while (*q) {
      ll t = *p / *q;
      for (int i = 0; i < (int)(3); i++) swap(p[i] -= t * q[i], q[i]);
    }
    if (p[0] < 0)
      for (int i = 0; i < (int)(3); i++) p[i] = -p[i];
    x = p[1], y = p[2];
    return p[0];
  }
  ModInt inv() const {
    ll x, y;
    extgcd(v, mod, x, y);
    return make(normS(x + mod));
  }
  ModInt pow(ll p) const {
    if (p < 0) return inv().pow(-p);
    ModInt a = 1;
    ModInt x = *this;
    while (p) {
      if (p & 1) a *= x;
      x *= x;
      p >>= 1;
    }
    return a;
  }
  bool operator==(const ModInt& b) const { return v == b.v; }
  bool operator!=(const ModInt& b) const { return v != b.v; }
  friend istream& operator>>(istream& o, ModInt& x) {
    ll tmp;
    o >> tmp;
    x = ModInt(tmp);
    return o;
  }
  friend ostream& operator<<(ostream& o, const ModInt& x) { return o << x.v; }
};
using mint = ModInt<998244353>;
V<mint> fact, ifact;
mint Choose(int a, int b) {
  if (b < 0 || a < b) return 0;
  return fact[a] * ifact[b] * ifact[a - b];
}
void InitFact(int N) {
  fact.resize(N);
  ifact.resize(N);
  fact[0] = 1;
  for (int i = 1; i <= (int)(N - 1); i++) fact[i] = fact[i - 1] * i;
  ifact[N - 1] = fact[N - 1].inv();
  for (int i = N - 2; i >= 0; i--) ifact[i] = ifact[i + 1] * (i + 1);
}
int bsr(int x) {
  if (x == 0) return -1;
  return 31 ^ __builtin_clz(x);
}
V<int> ds;
VV<mint> memo;
VV<bool> done;
mint solve(int N, int odd) {
  if (done[N][odd]) return memo[N][odd];
  if (N == 0) return 1;
  mint res = 0;
  for (int l = 0; l < (int)(N); l++)
    if (l % 2 == odd) {
      int r = N - 1 - l;
      if (ds[l] + ds[r] + N - 1 == ds[N]) {
        res += solve(l, odd ^ 1) * solve(r, 1);
      }
    }
  done[N][odd] = true;
  return memo[N][odd] = res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N;
  cin >> N;
  int x = 1;
  auto ONE = []() {
    cout << 1 << endl;
    exit(0);
  };
  while (x <= N) {
    if (x == N) ONE();
    x++;
    if (x == N) ONE();
    x *= 2;
    if (x == N) ONE();
    x++;
    if (x == N) ONE();
    x *= 2;
    x--;
  }
  cout << 0 << endl;
}