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