#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
int main() {
  int n;
  cin >> n;
  if (n == 2) {
    cout << 1 << endl << 1 << " " << 1 << endl;
    return 0;
  } else if (n == 3) {
    cout << "0\n2 1 2\n";
  } else if (n == 4) {
    cout << "0\n2 1 4\n";
  } else {
    vector<int> v;
    vector<int> c;
    lli sum_v = 0, sum_c = 0;
    for (lli i = n; i >= 1; i--) {
      if (abs(sum_v + i - sum_c) < abs(sum_c + i - sum_v)) {
        sum_v += i;
        v.push_back(i);
      } else {
        sum_c += i;
        c.push_back(i);
      }
    }
    cout << abs(sum_v - sum_c) << endl;
    cout << c.size() << " ";
    int in = c.size();
    for (lli i = 0; i < (in); i++) {
      cout << c[i];
      if (i == in - 1)
        cout << endl;
      else
        cout << " ";
    }
  }
}
