#include <bits/stdc++.h>
using namespace std;
const int N = 60004;
int a[N];
vector<int> vec;
int main() {
  int n;
  int i;
  scanf("%d", &n);
  long long int sum = (1LL * n * (n + 1)) / 2;
  if (sum % 2 == 0)
    printf("0\n");
  else
    printf("1\n");
  sum = sum / 2;
  int cnt = 0;
  for (i = n; i >= 1; i--) {
    cnt = cnt + i;
    if (cnt <= sum) {
      vec.push_back(i);
    } else {
      cnt = cnt - i;
      if (cnt == sum) break;
      vec.push_back(sum - cnt);
      break;
    }
  }
  printf("%d ", vec.size());
  for (i = 0; i < vec.size(); i++) printf("%d ", vec[i]);
  return 0;
}
