#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 5, MOD = 1e9 + 7;
long long int n;
vector<long long int> ans;
long long int a[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  long long int sum = (n * (n + 1LL)) / 2;
  if (sum % 2 == 0) {
    cout << "0\n";
  } else {
    cout << "1\n";
  }
  sum /= 2;
  long long int mx = n;
  while (sum) {
    long long int k = min(sum, mx);
    ans.push_back(k);
    sum -= k;
    if (k == mx) mx--;
  }
  cout << (int)ans.size() << " ";
  for (int i = 0; i < (int)ans.size(); i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
