#include <bits/stdc++.h>
using namespace std;
bool mycomp(long long a, long long b) { return (a > b); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> v(n, 0);
  for (long long i = 0; i < n; i++) {
    v[i] = i + 1;
  }
  sort(v.begin(), v.end(), mycomp);
  long long k = n % 4;
  if (k == 0) {
    cout << 0 << endl;
    cout << (n / 2) << " ";
    long long i = 0;
    n = v.size();
    while ((i + 3) < n) {
      cout << v[i] << " ";
      cout << v[i + 3] << " ";
      i += 4;
    }
    return 0;
  }
  if (k == 1) {
    cout << 1 << endl;
    cout << (n / 2) << " ";
    v.pop_back();
    long long i = 0;
    n = v.size();
    while ((i + 3) < n) {
      cout << v[i] << " ";
      cout << v[i + 3] << " ";
      i += 4;
    }
    return 0;
  }
  if (k == 2) {
    cout << 1 << endl;
    cout << (n / 2) << " ";
    v.pop_back();
    v.pop_back();
    cout << 1 << " ";
    long long i = 0;
    n = v.size();
    while ((i + 3) < n) {
      cout << v[i] << " ";
      cout << v[i + 3] << " ";
      i += 4;
    }
    return 0;
  }
  if (k == 3) {
    cout << 0 << endl;
    cout << (n / 2) << " ";
    v.pop_back();
    v.pop_back();
    v.pop_back();
    cout << 3 << " ";
    n = v.size();
    long long i = 0;
    while ((i + 3) < n) {
      cout << v[i] << " ";
      cout << v[i + 3] << " ";
      i += 4;
    }
    return 0;
  }
  return 0;
}
