#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, temp = 0;
  cin >> n;
  long long int p = n * (n + 1) / 2;
  if (p % 2 == 0) {
    cout << "0\n";
  } else {
    cout << "1\n";
  }
  long long int sum = 0, find = p / 2;
  long long int A[n], i = 0;
  A[i] = n;
  sum += A[i];
  while (sum != find) {
    if (sum > find || A[i] <= 0) {
      sum -= A[i];
      if (i != 0) {
        i--;
        sum -= A[i];
      }
      A[i]--;
    } else {
      i++;
      A[i] = A[i - 1] - 1;
    }
    sum += A[i];
  }
  cout << i + 1 << " ";
  for (long long int j = 0; j <= i; j++) {
    cout << A[j] << " ";
  }
  return 0;
}
