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