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