#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  vector<int> hi;
  if (n % 2 == 0 && n % 4 == 2) {
    cout << 1 << "\n";
    for (int i = 1; i <= n; i++)
      if (i % 4 == 1 || i % 4 == 0) hi.push_back(i);
    cout << hi.size() << " ";
    for (int i = 0; i < hi.size(); i++) cout << hi[i] << " ";
  } else if (n % 2 == 0 && n % 4 == 0) {
    cout << 0 << "\n";
    for (int i = 1; i <= n; i++)
      if (i % 4 == 1 || i % 4 == 0) hi.push_back(i);
    cout << hi.size() << " ";
    for (int i = 0; i < hi.size(); i++) cout << hi[i] << " ";
  } else if (n % 2 == 1 && n % 4 == 1) {
    cout << 1 << "\n";
    hi.push_back(3);
    for (int i = 4; i <= n; i++)
      if (i % 4 == 1 || i % 4 == 2) hi.push_back(i);
    cout << hi.size() << " ";
    for (int i = 0; i < hi.size(); i++) cout << hi[i] << " ";
  } else {
    cout << 0 << "\n";
    hi.push_back(1);
    hi.push_back(2);
    for (int i = 4; i <= n; i++)
      if (i % 4 == 1 || i % 4 == 2) hi.push_back(i);
    cout << hi.size() << " ";
    for (int i = 0; i < hi.size(); i++) cout << hi[i] << " ";
  }
  return 0;
}
