#include <bits/stdc++.h>
using namespace std;
long long a[2000010], d[2000010];
long long b[200010], f[1010][1010];
long long mn = 1e18, mx = -1e18, ans, sm = 1, cnt, n, m, cur;
bool ok, u[1000010], uu[310][310];
char c[510][510], cc[100010];
int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
vector<long long> g[900010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  long long x = ((n * (n + 1)) / 2) % 2;
  if (x == 1) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  x = (n * (n + 1)) / 4;
  vector<int> v;
  for (int i = min(n, x); i > 0; i--) {
    if (x - i >= 0) {
      v.push_back(i);
      x -= i;
    }
  }
  cout << v.size() << ' ';
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << ' ';
  }
  return 0;
}
