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