#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int i, j, k, p, q, r, n, m, ans;
  scanf("%d", &n);
  vector<int> vec;
  int sum = 0;
  for (i = 1; i <= n; i++) {
    sum += i;
  }
  if (sum % 2 == 0) {
    ans = 0;
  } else {
    ans = 1;
  }
  p = sum / 2;
  for (i = n; i >= 1; i--) {
    if (p == 0) {
      break;
    }
    if (i <= p) {
      vec.push_back(i);
      p -= i;
    }
  }
  printf("%d\n", ans);
  reverse(vec.begin(), vec.end());
  int l = vec.size();
  printf("%d ", l);
  for (i = 0; i < l; i++) {
    if (i) {
      printf(" ");
    }
    printf("%d", vec[i]);
  }
  return 0;
}
