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