#include <bits/stdc++.h>
using namespace std;
int n;
int height;
bool tree[1 << 20] = {false};
bool edge[1 << 20] = {false};
int inorder[1 << 20];
int counter = 0;
void dfs(int curr, int depth) {
  if (depth == height) {
    edge[curr] = true;
    inorder[counter] = curr;
    counter++;
    return;
  }
  tree[curr * 2 + 1] = !tree[curr];
  dfs(curr * 2 + 1, depth + 1);
  inorder[counter] = curr;
  counter++;
  tree[curr * 2 + 2] = tree[curr];
  dfs(curr * 2 + 2, depth + 1);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  height = 0;
  if (n == 1) {
    cout << "1"
         << "\n";
    return 0;
  }
  while ((1 << height) - 1 < n) {
    height++;
  }
  height--;
  if (n % 2 == 0) {
    tree[0] = true;
  } else {
    tree[0] = false;
  }
  dfs(0, 0);
  int canDo = true;
  int more = (n - (1 << (height)) + 1);
  if (!tree[inorder[0]]) {
    more--;
    if (more < 0) {
      cout << 0 << "\n";
      return 0;
    }
  }
  for (int i = 2; i < (1 << (height + 1)) - 2; i++) {
    if (edge[inorder[i]]) {
      if (tree[inorder[i - 1]] == tree[inorder[i + 1]]) {
        more--;
        if (more < 0) {
          cout << 0 << "\n";
          return 0;
        }
      }
    }
  }
  if (more == 0) {
    cout << 1 << "\n";
  } else {
    cout << 0 << "\n";
  }
}
