#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 1;
const int MOD = 1000000007;
const long long MAX = 10000000000;
const int oo = 1e9;
long long n;
map<long long, int> ans;
int main() {
  cin >> n;
  if (n == 1 || n == 2) {
    puts("1");
    return 0;
  }
  long long cur = 4;
  while (cur <= n) {
    ans[cur] = ans[cur + 1] = 1;
    bool odd = cur % 2;
    cur = cur * 2 + 1 + odd;
  }
  printf("%d\n", ans[n]);
  return 0;
}
