#include <bits/stdc++.h>
using namespace std;
long long max_(long long a, long long b) { return a > b ? a : b; }
int main() {
  long long n;
  scanf("%lld", &n);
  if (n == 1 || n == 2)
    printf("1\n");
  else {
    long long x = 4, y = 5;
    while (max_(x, y) < n) {
      int xx = x, yy = y;
      if (x & 1)
        x = yy + xx + 1, y = yy * 2 + 1;
      else
        x = yy + xx + 1, y = xx * 2 + 1;
      if (x > y) swap(x, y);
    }
    if (x == n || y == n)
      printf("1\n");
    else
      printf("0\n");
  }
}
