#include <bits/stdc++.h>
using namespace std;
int dp[22][2];
int sol(int i, int parity) {
  if (i == 2) {
    if (parity == 0)
      return 4;
    else
      return 5;
  }
  if (dp[i][parity] != -1) return dp[i][parity];
  return dp[i][parity] = 1 + sol(i - 1, 1 - parity) + sol(i - 1, 0);
}
int main() {
  memset(dp, -1, sizeof(dp));
  int n;
  scanf("%d", &n);
  int pw = 0;
  for (int i = 1; i < 30; i++) {
    if ((1 << (i + 1)) - 1 > n) {
      pw = i;
      break;
    }
  }
  int ans = 0;
  if (n < 4) {
    if (n == 1 || n == 2)
      ans = 1;
    else
      ans = 0;
  } else {
    if (sol(pw, 0) == n) ans++;
    if (sol(pw, 1) == n) ans++;
  }
  printf("%d\n", ans);
}
