#include <bits/stdc++.h>
using namespace std;
int a[60005], b[30005], c[30005];
int main(int argc, char const *argv[]) {
  int n, sum;
  cin >> n;
  srand(0);
  int m = n / 2, mm = m + 1, sum1 = 0, sum2 = 0;
  for (int i = 1; i <= m; i++) {
    b[i] = i;
    sum1 += b[i];
  }
  for (int i = mm; i <= n; ++i) {
    c[i - mm + 1] = i;
    sum2 += c[i - mm + 1];
  }
  int t = 500005;
  while (t--) {
    int ind1 = 1 + rand() % m, ind2 = 1 + rand() % (n - mm + 1);
    if (abs((sum1 - b[ind1] + c[ind2]) - (sum2 - c[ind2] + b[ind1])) <
        abs(sum1 - sum2)) {
      sum1 = sum1 - b[ind1] + c[ind2];
      sum2 = sum2 - c[ind2] + b[ind1];
      swap(b[ind1], c[ind2]);
    }
  }
  printf("%d\n", abs(sum1 - sum2));
  printf("%d ", m);
  for (int i = 1; i <= m; ++i) {
    printf("%d ", b[i]);
  }
  return 0;
}
