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;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
const int LOG = 21;
const int NN = (int)2;
const int MAXN = (int)60000 + 5;
const int MOD = (int)1e9 + 7;
const int INF = 1 << 27;
int mul(int x, int y) { return (1LL * x * y) % MOD; }
int add(int x, int y) {
  long long res = x;
  res += y;
  return (res % MOD + MOD) % MOD;
}
int fast_pow(int x, int y) {
  if (y == 0) return 1;
  if (y & 1)
    return mul(x, fast_pow(x, y - 1));
  else {
    int aux = fast_pow(x, y >> 1);
    return mul(aux, aux);
  }
}
int two(int x) { return 1 << x; }
bool contain(int mask, int bit) { return (mask & two(bit)) > 0; }
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int bit_count(int x) { return x == 0 ? 0 : (x & 1) + bit_count(x >> 1); }
long long dp[20][NN][NN][NN];
long long rec(int f, int l, int r, int d, int mx_d, int dir) {
  if (l > r) return d + 1 < mx_d ? 0 : 1;
  if (d >= mx_d) return 0;
  long long& res = dp[d][f + 1][l][r];
  if (~res) return res;
  res = 0;
  for (int i = l; i <= r; i++) {
    if (f != -1 && dir == 1 && (f % 2) != (i % 2)) continue;
    if (f != -1 && dir == 0 && (f % 2) == (i % 2)) continue;
    int A = rec(i, l, i - 1, d + 1, mx_d, 0);
    int B = rec(i, i + 1, r, d + 1, mx_d, 1);
    res += A * B;
  }
  return res;
}
int solve(int n) {
  int cur = 2;
  int state = 1;
  while (cur - 1 <= n) {
    int A = cur - 1, B = cur;
    42;
    if (n == A || n == B) return 1;
    if (state == 0) {
      cur = B * 2;
    } else {
      cur = B * 2 + 1;
    }
    state = 1 - state;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  int ans = solve(n);
  printf("%d\n", ans);
  return 0;
}