#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long ts = (n * (n + 1)) / 2;
  long long k = ts / 2;
  cout << ts % 2 << endl;
  vector<long long> fg;
  for (int i = n; i > 0 && k; i--) {
    if (k >= i) {
      k -= i;
      fg.push_back(i);
    }
  }
  cout << fg.size();
  for (int j : fg) {
    cout << ' ' << j;
  }
  cout << endl;
}
