#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(NULL));
  long long month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  long long n;
  cin >> n;
  if (n == 2) {
    cout << 1 << endl;
    cout << 1 << " " << 1 << endl;
    return (0);
  }
  long long total_sum = (n * (n + 1)) / 2;
  if (total_sum % 2 == 0) {
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
  long long gp1sum = (total_sum / 2);
  vector<long long> ans;
  for (long long i = n; i > 0; i--) {
    if (gp1sum - i >= 0) {
      ans.push_back(i);
      gp1sum -= i;
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.size() << " ";
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
