#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  if (n % 4 == 0) {
    printf("0\n");
    printf("%d ", n / 2);
    for (int i = 0; i < n / 2; i += 2) {
      printf("%d ", i + 1);
      printf("%d ", n - i);
    }
  } else if (n % 4 == 2) {
    printf("1\n");
    printf("%d ", n / 2);
    for (int i = 0; i < (n - 1) / 2; i += 2) {
      printf("%d ", i + 1);
      printf("%d ", n - i);
    }
    printf("%d", n / 2);
  } else if (n % 4 == 1) {
    printf("1\n");
    printf("%d ", (n + 1) / 2);
    for (int i = 0; i < n / 2; i += 2) {
      printf("%d ", i + 2);
      printf("%d ", n - i);
    }
    printf("1");
  } else if (n % 4 == 3) {
    printf("0\n");
    printf("%d ", n / 2);
    for (int i = 0; i < (n - 3) / 2; i += 2) {
      printf("%d ", i + 4);
      printf("%d ", n - i);
    }
    printf("3");
  }
  return 0;
}
