#include <bits/stdc++.h>   using namespace std;   vector<int> v;   void dfs(int depth, bool state) {     if (depth == 0) return;     dfs(depth - 1, !state);     v.push_back(state);     dfs(depth - 1, state);   }   int main() {     int N;     cin >> N;     int D = 1;     while (1 << D <= N) D++;     dfs(D - 1, 1);     int n = v.size();     for (int i = 0; i < (int)v.size() - 1; i++) n += (v[i] == v[i + 1]);     cout << (n == N or n + 1 == N) << endl;   }   