#include <bits/stdc++.h>
using namespace std;
mt19937 mt_rand(time(0));
const int N = 1e5 + 5;
int n;
int main() {
  scanf("%d", &n);
  int k = 1;
  while (2 * k + 1 <= n) k = 2 * k + 1;
  int m = k + 1;
  int r = n - k;
  int ile = 0;
  for (int i = 1; i < m; i++) {
    int x = __builtin_ctz(i);
    ile += (x & 1);
  }
  printf("%d\n", (int)(r == ile || r == ile + 1));
  return 0;
}
