#include <bits/stdc++.h>
using namespace std;
struct fast_ios {
  fast_ios() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios_;
vector<int> binary;
void dfs(int depth, int state) {
  if (depth == 0) return;
  dfs(depth - 1, !state);
  binary.push_back(state);
  dfs(depth - 1, state);
}
int main() {
  int N;
  cin >> N;
  multiset<int> ret{1, 2, 4, 5};
  if (ret.count(N)) {
    puts("1");
    return 0;
  }
  if (__builtin_popcount(N + 1) == 1) {
    puts("0");
    return 0;
  }
  int D = 1;
  while ((1LL << (D)) < N) D++;
  D--;
  dfs(D, 1);
  int n = binary.size();
  for (int i = (0), i_end_ = (binary.size() - 1); i < i_end_; i++)
    n += (binary[i] == binary[i + 1]);
  if (n == N or n + 1 == N)
    puts("1");
  else
    puts("0");
}
