#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
const long long MOD = 998244353;
long long f[N][2];
int n;
vector<int> ans;
int main() {
  cin >> n;
  ans.push_back(1);
  ans.push_back(2);
  int las = 2;
  while (1) {
    if (las % 2 == 0) {
      ans.push_back(las * 2);
      ans.push_back(las * 2 + 1);
      las = las * 2 + 1;
    } else {
      ans.push_back(las * 2 - 1);
      ans.push_back(las * 2);
      las = las * 2;
    }
    if (las > 1000000) break;
  }
  for (auto x : ans) {
    if (x == n) {
      return !printf("%d\n", 1);
    }
  }
  printf("0\n");
  return 0;
  cin >> n;
  f[0][0] = f[0][1] = 1;
  f[1][1] = 1, f[1][0] = 0;
  for (int i = 2; i <= n; i++) {
    for (int x = 0; x <= i - 1; x++) {
      if (abs((int)log2(x) - (int)log2(i - x - 1)) > 1) continue;
      if (abs((int)log2(x) - (int)log2(i - x - 1)) == 1) {
        if (x < i - x - 1 && ((x + 1) & (-(x + 1))) != (x + 1)) continue;
        if (x > i - x - 1 && ((i - x) & (-(i - x))) != i - x) continue;
      }
      if (x % 2) {
        (f[i][0] += (f[x][1] * f[i - x - 1][0]) % MOD) %= MOD;
      } else {
        (f[i][1] += (f[x][0] * f[i - x - 1][0]) % MOD) %= MOD;
      }
    }
    if (f[i][0] + f[i][1] > 0)
      printf("i = %d, %d %d %d\n", i, f[i][0], f[i][1], f[i][0] + f[i][1]);
  }
  printf("%lld\n", (f[n][0] + f[n][1]) % MOD);
}
