#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  int n;
  std::cin >> n;
  int cur = 1, add = 2;
  while (cur + 1 < n) {
    cur = cur * 2 + add;
    add = 3 - add;
  }
  std::cout << (n == cur || n == cur + 1) << '\n';
}
