#include <bits/stdc++.h>
using namespace std;
long long d[2][2];
int main() {
  int n;
  cin >> n;
  if (n == 1 || n == 2) {
    cout << 1;
    return 0;
  }
  d[0][0] = 4;
  d[0][1] = 5;
  while (d[0][0] < n && d[0][1] < n) {
    d[1][0] = d[0][1] + d[0][0] + 1;
    d[1][1] = d[0][0] + d[0][0] + 1;
    swap(d[0], d[1]);
  }
  if (d[0][0] == n || d[0][1] == n)
    cout << 1;
  else
    cout << 0;
}
