#include <bits/stdc++.h>
using namespace std;
const long long md = 1e9 + 7;
long long a[1000005], n;
vector<int> res;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long q, m, k, h, ans = 0, sum = 0, p, x, y;
  cin >> n;
  if (n % 4 == 0) {
    cout << "0\n";
    x = 0;
    for (int i = 0; i + 4 <= n; i += 4) {
      res.push_back(i + 1);
      res.push_back(i + 4);
    }
  } else if (n % 4 == 1) {
    cout << "1\n";
    x = 1;
    for (int i = 2; i + 3 <= n; i += 4) {
      res.push_back(i);
      res.push_back(i + 3);
    }
  } else if (n % 4 == 2) {
    cout << "1\n";
    x = 1;
    for (int i = 0; i + 4 <= n; i += 4) {
      res.push_back(i + 1);
      res.push_back(i + 4);
    }
    res.push_back(n - 1);
  } else if (n % 4 == 3) {
    cout << "0\n";
    x = 0;
    for (int i = 4; i + 3 <= n; i += 4) {
      res.push_back(i);
      res.push_back(i + 3);
    }
    res.push_back(1);
    res.push_back(2);
  }
  cout << res.size() << ' ';
  for (int i : res) {
    cout << i << ' ';
    sum += i;
  }
  ans = abs(n * (n + 1) / 2 - 2 * sum);
  assert(x == ans);
}
