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