#include <bits/stdc++.h>
using namespace std;
int a[60000];
int main() {
  int n, sum, p, s = 0, q;
  scanf("%d", &n);
  if (n % 2 == 0)
    sum = n / 2 * (n + 1);
  else
    sum = (n + 1) / 2 * n;
  if (sum % 2 == 0)
    printf("0\n");
  else
    printf("1\n");
  p = sum / 2;
  q = p % (n + 1);
  if (q != 0) a[s++] = q;
  p -= q;
  for (int i = 1; i <= n && p != 0; i++) {
    if (i != q && (n + 1 - i) != q) {
      a[s++] = i;
      a[s++] = n + 1 - i;
      p -= n + 1;
    }
  }
  printf("%d", s);
  for (int i = 0; i < s; i++) printf(" %d", a[i]);
  printf("\n");
  return 0;
}
