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