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 T>
void _R(T &_x) {
  cin >> _x;
}
void _R(int &_x) { scanf("%d", &_x); }
void _R(int64_t &_x) { scanf("%" SCNd64, &_x); }
void _R(double &_x) { scanf("%lf", &_x); }
void _R(char &_x) { scanf(" %c", &_x); }
void _R(char *_x) { scanf("%s", _x); }
template <class T, class U>
void _R(pair<T, U> &_x) {
  _R(_x.first);
  _R(_x.second);
}
void R() {}
template <class T, class... U>
void R(T &_head, U &..._tail) {
  _R(_head);
  R(_tail...);
}
template <class T>
void _W(const T &_x) {
  cout << _x;
}
void _W(const int &_x) { printf("%d", _x); }
void _W(const int64_t &_x) { printf("%" PRId64, _x); }
void _W(const double &_x) { printf("%.16f", _x); }
void _W(const char &_x) { putchar(_x); }
void _W(const char *_x) { printf("%s", _x); }
template <class T, class U>
void _W(const pair<T, U> &_x) {
  _W(_x.first);
  putchar(' ');
  _W(_x.second);
}
template <class T>
void _W(const vector<T> &_x) {
  for (auto i = _x.begin(); i != _x.end(); _W(*i++))
    if (i != _x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &_head, const U &..._tail) {
  _W(_head);
  putchar(sizeof...(_tail) ? ' ' : '\n');
  W(_tail...);
}
template <class T, class... U>
void DB(const T &_head, const U &..._tail) {}
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
inline int LG(const unsigned int &_x) { return 31 - __builtin_clz(_x); }
const int MOD = 998244353;
inline int ADD(int a, int b) { return a + b < MOD ? a + b : a + b - MOD; }
inline int MUL(int a, int b) { return (a * b) % MOD; }
int n;
map<pair<int, int>, int> f;
int compute(pair<int, int> x) {
  auto p = f.find(x);
  if (p != f.end()) return (*p).second;
  int d = LG(x.first), base = (1 << d) - 1, r = x.first - base;
  int s = 0;
  for (int i = (0); i <= (min(r, base / 2 + 1)); ++i) {
    if (0 <= r - i && r - i <= base / 2 + 1 &&
        ((base / 2 + i + 1) % 2 == x.second)) {
      int f1 = compute({base / 2 + i, x.second ^ 1});
      int f2 = compute({base / 2 + r - i, 0});
      s = ADD(s, MUL(f1, f2));
    }
  }
  f[x] = s;
  return s;
}
int main() {
  R(n);
  f[{1, 1}] = 1;
  f[{1, 0}] = 0;
  f[{2, 1}] = 0;
  f[{2, 0}] = 1;
  f[{3, 1}] = 0;
  f[{3, 0}] = 0;
  int it0 = 2;
  int it1 = 1;
  for (int i = (0); i <= (int(30) - 1); ++i) {
    if (n == it0 || n == it1) {
      W("1");
      return 0;
    }
    it0 = 2 * max(it0, it1);
    if (i & 1)
      it1 = it0 - 1;
    else
      it1 = it0 + 1;
    DB(it0, it1);
  }
  W("0");
  return 0;
}