#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, i, p, q, s, k, m, l, x, y;
  cin >> n;
  l = (n * (n + 1)) / 2;
  if (l % 2 == 0) {
    cout << 0 << endl;
    p = 1;
    q = 2;
    s = p + q;
    x = l / 2;
    for (int i = 1; i < n + 1; i++) {
      if (s < x) {
        q++;
        s = s + q;
      } else if (s > x) {
        s = s - p;
        p++;
      } else {
        cout << q - p + 1 << " ";
        for (int i = p; i < q + 1; i++) cout << i << " ";
        break;
      }
    }
  } else {
    cout << 1 << endl;
    p = 1;
    q = 2;
    s = p + q;
    x = (l + 1) / 2;
    for (int i = 1; i < n + 1; i++) {
      if (s < x) {
        q++;
        s = s + q;
      } else if (s > x) {
        s = s - p;
        p++;
      } else {
        cout << q - p + 1 << " ";
        for (int i = p; i < q + 1; i++) cout << i << " ";
        return 0;
      }
    }
    x = (l - 1) / 2;
    p = 1;
    q = 2;
    s = 3;
    for (int i = 1; i < n + 1; i++) {
      if (s < x) {
        q++;
        s = s + q;
      } else if (s > x) {
        s = s - p;
        p++;
      } else {
        cout << q - p + 1 << " ";
        for (int i = p; i < q + 1; i++) cout << i << " ";
        break;
      }
    }
  }
}
