#include <bits/stdc++.h>
using namespace std;
const long long nax = 3e5 + 5;
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 7;
long long n, m;
long long a[nax];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n;
  vector<long long> v;
  long long sum = (n) * (n + 1);
  sum /= 2;
  long long req = sum / 2;
  if (sum % 2 == 0) {
    cout << 0 << "\n";
    long long j = 1;
    for (long long i = n; i > 1; i -= 2) {
      j = !j;
      v.push_back(i - j);
    }
  } else {
    cout << 1 << "\n";
    long long j = 1;
    for (long long i = n; i > 1; i -= 2) {
      j = !j;
      v.push_back(i - j);
    }
  }
  cout << v.size() << " ";
  for (auto u : v) cout << u << " ";
  cout << "\n";
  return 0;
}
