#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long MaxS = n * (n + 1) / 2;
  long long l = 0;
  long long r = MaxS;
  long long m;
  while (l < r) {
    m = (l + r) / 2;
    if (m < (MaxS - m)) {
      l = m + 1;
    } else {
      r = m;
    }
  }
  cout << abs(MaxS - 2 * r);
  return 0;
}
