#include <bits/stdc++.h>
using namespace std;
int N;
bool cnt[1000005];
int main() {
  int a = 1, b = 2, c, d;
  while (a < 1000000 && b < 1000000) {
    cnt[a] = 1, cnt[b] = 1;
    c = 1 + b + b, d = 1 + a + b;
    a = c, b = d;
  }
  scanf("%d", &N);
  printf("%d", cnt[N]);
}
