#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int mod = 998244353;
const vector<int> mods = {998244353, 1000000007, 1000000009};
const long long inf = 3e18;
const double eps = 0.0000001;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long n;
long long dp[1000010][2];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.precision(13);
  cin >> n;
  dp[0][0] = dp[0][1] = 1;
  for (long long i = (1); i < (n + 1); ++i) {
    if (i & 1)
      dp[i][(~(i >> 1)) & 1] = (dp[i / 2][0] * dp[i / 2][1]) % mod;
    else
      dp[i][0] = dp[i][1] =
          (dp[i / 2 - 1][1] * dp[i / 2][0]) + (dp[i / 2][1] * dp[i / 2 - 1][0]);
  }
  cout << max(dp[n][1], dp[n][0]) << "\n";
  return 0;
}
