#include <bits/stdc++.h>
using namespace std;
int cnt(int n) {
  if (n == 1)
    return 1;
  else if (n == 2)
    return 1;
  else if (n == 3)
    return 0;
  else {
    int e = 0;
    int leaves = n;
    while (leaves >= (1 << e)) {
      leaves -= (1 << e);
      e++;
    }
    if (2 * leaves > (1 << e))
      return 0;
    else if (leaves == 0)
      return 0;
    else
      return cnt(n - 2 * leaves);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", cnt(n));
  return 0;
}
