#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  if (n == 1 || n == 2 || n == 4) {
    cout << 1;
    return 0;
  }
  long long lg = 0;
  while ((1 << (lg + 1)) - 1 <= n) lg++;
  long long u = (1 << lg);
  long long kek = u - 1;
  for (long long t = 4; t <= u; t *= 4) kek += u / t;
  if ((n == kek) || (n == kek + 1))
    cout << 1;
  else
    cout << 0;
}
