#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x = n;
  if (n % 4 == 0) {
    cout << "0" << endl;
    cout << n / 2 << " ";
    while (x >= 4) {
      cout << x << " " << x - 3 << " ";
      x = x - 4;
    }
  } else if (n % 4 == 1) {
    cout << "1" << endl;
    cout << (n - 1) / 2 << " ";
    while (x >= 4) {
      cout << x << " " << x - 3 << " ";
      x = x - 4;
    }
  } else if (n % 4 == 2) {
    cout << "1" << endl;
    cout << (n - 2) / 2 + 1 << " ";
    while (x >= 4) {
      cout << x << " " << x - 3 << " ";
      x = x - 4;
    }
    cout << "2";
  } else if (n % 4 == 3) {
    cout << "0" << endl;
    cout << (n - 3) / 2 + 1 << " ";
    while (x >= 4) {
      cout << x << " " << x - 3 << " ";
      x = x - 4;
    }
    cout << "3";
  }
}
