#include <bits/stdc++.h>
using namespace std;
const long long N = 1e4;
vector<bool> used(N);
vector<long long> g[N];
void dfs(long long u) {
  used[u] = 1;
  for (auto i : g[u]) {
    if (!used[i]) dfs(i);
  }
}
signed main() {
  long long n;
  cin >> n;
  if ((n * (n + 1) / 2) % 2)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  long long t = n;
  long long sum = n * (n + 1) / 4;
  vector<long long> ans;
  while (sum > 0) {
    if (sum >= n) {
      sum -= n;
      ans.push_back(n);
      n--;
    } else {
      ans.push_back(sum);
      sum = 0;
    }
  }
  cout << ans.size() << " ";
  for (auto i : ans) cout << i << " ";
}
