#include <bits/stdc++.h>
using namespace std;
int n;
const int mod = 998244353;
const int maxn = 1000010;
int dp[maxn][2];
int k[maxn], vis[maxn], dep[maxn];
void solve(int n) {
  if (vis[n]) return;
  vis[n] = 1;
  int d = k[n];
  for (int x = 0; x <= d; x++) {
    int L = (n - d - 1) / 2 + x;
    int R = (n - d - 1) / 2 + (d - x);
    if (x == 0 && dep[L] == dep[n] - 1) continue;
    if (d - x == 0 && dep[R] == dep[n] - 1) continue;
    if (x > 0 && k[L] != x) continue;
    if (d - x > 0 && k[R] != d - x) continue;
    solve(R);
    if (dp[R][1] == 0) continue;
    solve(L);
    if (L % 2 == 0) {
      dp[n][0] = (dp[n][0] + 1ll * dp[L][1] * dp[R][1]) % mod;
    } else {
      dp[n][1] = (dp[n][1] + 1ll * dp[L][0] * dp[R][1]) % mod;
    }
  }
}
int main() {
  cin >> n;
  int s = 1, e = 0;
  if (n == 1) {
    cout << "1" << endl;
    return 0;
  }
  while (1) {
    s++;
    if (s == n) {
      cout << "1" << endl;
      return 0;
    }
    s *= 2;
    e++;
    if (e % 2 == 0) {
      s--;
    }
    if (s == n) {
      cout << "1" << endl;
      return 0;
    }
    if (s > n) break;
  }
  cout << 0 << endl;
  return 0;
}
