#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int main() {
  long long n;
  while (cin >> n) {
    v.clear();
    long long temp = (n * (n + 1) / 2 + 1) / 2;
    for (int i = n; i >= 1; i--) {
      if (temp >= i) {
        temp -= i;
        v.push_back(i);
      }
    }
    temp = n * (n + 1) / 2;
    if (temp % 2 != 0)
      cout << 1 << endl;
    else
      cout << 0 << endl;
    cout << v.size() << ' ';
    for (int i = 0; i < v.size(); i++) {
      cout << v[i] << ' ';
    }
    cout << endl;
  }
  return 0;
}
