#include <bits/stdc++.h>
using namespace std;
long long n, s, gSum, l = 1, r = 1;
long long sum(long long l, long long r) { return (l + r) * (r - l + 1) / 2; }
int main() {
  cin >> n;
  gSum = sum(1, n);
  while (l <= n && r <= n) {
    s = sum(l, r);
    if (gSum % 2 != 0) {
      if (s == gSum / 2 || s == gSum / 2 + 1) break;
      if (s < gSum / 2 + 1)
        r++;
      else
        l++;
    } else {
      if (s == gSum / 2) break;
      if (s < gSum / 2)
        r++;
      else
        l++;
    }
  }
  cout << (gSum % 2 == 0 ? 0 : 1) << endl;
  cout << r - l + 1 << " ";
  for (int i = (l); i < (r + 1); i++) printf("%d ", i);
  return 0;
}
