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