#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n <= 3) {
    cout << (n != 3);
    return 0;
  }
  int a = 2, b = 1, x = 2;
  while (min(a + x + 1, b + x + 1) <= n) {
    if (a + x + 1 == n || b + x + 1 == n) {
      cout << 1;
      return 0;
    }
    int X = b + x + 1;
    int B = a + x + 1;
    int A = b + x + 1;
    a = A;
    b = B;
    x = X;
  }
  cout << 0 << '\n';
  return 0;
}
