#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;
}
