#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, i;
  cin >> n;
  if (n % 4 == 0) {
    cout << 0 << "\n" << n / 2 << " ";
    for (i = 1; i <= n / 4; i++) cout << i << " " << n - (i - 1) << " ";
    return 0;
  }
  vector<long long> vec;
  if (n % 4 == 2) {
    cout << 1 << "\n";
    long long siz = (n * (n + 1)) / 2;
    siz += 1;
    siz /= 2;
    for (i = n; i >= 1; i--) {
      if (siz >= i) {
        vec.push_back(i);
        siz -= i;
      }
    }
    cout << vec.size();
    long long q = vec.size();
    for (int i = 0; i < (q); i++) cout << " " << vec[i];
    return 0;
  }
  if (n % 4 == 1) {
    cout << 1 << "\n";
    long long siz = (n * (n + 1)) / 2;
    siz += 1;
    siz /= 2;
    for (i = n; i >= 1; i--) {
      if (siz >= i) {
        vec.push_back(i);
        siz -= i;
      }
    }
    cout << vec.size();
    long long q = vec.size();
    for (int i = 0; i < (q); i++) cout << " " << vec[i];
    return 0;
  }
  if (n % 4 == 3) {
    cout << 0 << "\n";
    long long siz = (n * (n + 1)) / 2;
    siz /= 2;
    for (i = n; i >= 1; i--) {
      if (siz >= i) {
        vec.push_back(i);
        siz -= i;
      }
    }
    cout << vec.size();
    long long q = vec.size();
    for (int i = 0; i < (q); i++) cout << " " << vec[i];
    return 0;
  }
  return 0;
}
