#include <bits/stdc++.h>
using namespace std;
vector<int> v;
void dfs(int depth, int state) {
  if (depth == 0) return;
  dfs(depth - 1, !state);
  v.push_back(state);
  dfs(depth - 1, state);
}
int main() {
  int N;
  cin >> N;
  if (__builtin_popcount(N + 1) == 1) {
    cout << (N == 1) << endl;
    return 0;
  }
  int D = 1;
  while (1 << D <= N) D++;
  dfs(D - 1, 1);
  int n = v.size();
  for (int i = (0), i_end_ = (v.size() - 1); i < i_end_; i++)
    n += (v[i] == v[i + 1]);
  cout << (n == N or n + 1 == N) << endl;
}
