#include <bits/stdc++.h>
using namespace std;
const char E = '\n';
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  if (n == 2) {
    cout << 1 << E << 1 << " " << 1 << E;
    return 0;
  }
  if (n == 3) {
    cout << 0 << E << 1 << " " << 3 << E;
    return 0;
  }
  if (n == 4) {
    cout << 0 << E << 2 << " "
         << "1 4" << E;
    return 0;
  }
  long long s = (n + 1) * n;
  s /= 2;
  long long q = s / 2;
  long long s1 = 0, s2 = 0;
  int k1 = 0;
  int a1[70005] = {0};
  for (long long i = n; i >= 1; i--) {
    if (s1 + i > q)
      s2 += i;
    else {
      s1 += i;
      k1++;
      a1[k1] = i;
    }
  }
  cout << abs(s2 - s1) << E;
  cout << k1 << " ";
  for (int i = 1; i <= k1; i++) cout << a1[i] << " ";
  return 0;
}
