#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long CEL;
  if (n % 4 == 0 || n % 4 == 3) {
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
  CEL = (n * (n + 1)) / 2;
  if (CEL % 2 == 1) {
    CEL = CEL / 2;
    CEL++;
  } else {
    CEL = CEL / 2;
  }
  vector<int> wyniki;
  for (int i = n; i > 0; i--) {
    CEL -= i;
    wyniki.push_back(i);
    if (CEL <= i - 1 && CEL != 0) {
      wyniki.push_back(CEL);
      break;
    }
    if (CEL == 0) {
      break;
    }
  }
  long long suma = 0;
  cout << wyniki.size() << " ";
  for (int i = 0; i < wyniki.size(); i++) {
    cout << wyniki[i] << " ";
    suma += wyniki[i];
  }
}
