#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair < int, int > ii;
const int N = 300 + 5;
int n;
int ds[N][N];
vector < pair < ii, ii > > ans;
void add3(int a, int b, int c) {
ans.push_back({{a, b}, {c, 0}});
// printf("3 %d %d %d\n", a, b, c);
ds[a][b]++;
ds[b][c]++;
ds[c][a]++;
}
void add4(int a, int b, int c, int d) {
ans.push_back({{a, b}, {c, d}});
// printf("4 %d %d %d %d\n", a, b, c, d);
ds[a][b]++;
ds[b][c]++;
ds[c][d]++;
ds[d][a]++;
}
void check() {
printf("%d\n", ans.size());
for(auto x : ans) {
printf("%d", x.second.second ? 4 : 3);
printf(" %d %d %d", x.first.first, x.first.second, x.second.first);
if(x.second.second)
printf(" %d", x.second.second);
puts("");
}
for(int i = 1; i <= n; i++) {
for(int j = i + 1; j <= n; j++) {
int d = ds[i][j] + ds[j][i];
if(d != 2) {
printf("i = %d j = %d d = %d\n", i, j, d);
puts("ERROR!");
assert(0);
}
}
}
}
void solve(vector < int > v) {
if(v.size() <= 1)
return;
if(v.size() == 2) {
//impossible
puts("BRUH?");
return;
}
if(v.size() == 3) {
add3(v[0], v[1], v[2]);
add3(v[0], v[1], v[2]);
return;
}
if(v.size() == 4) {
add4(v[0], v[1], v[2], v[3]);
add4(v[0], v[1], v[3], v[2]);
add4(v[0], v[2], v[1], v[3]);
return;
}
if(v.size() == 5) {
add3(v[4], v[3], v[1]);
add3(v[2], v[0], v[4]);
add4(v[3], v[4], v[1], v[2]);
add4(v[3], v[2], v[1], v[0]);
add3(v[3], v[1], v[0]);
add3(v[2], v[0], v[4]);
return;
// 3 5 4 2
// 3 3 1 5
// 4 4 5 2 3
// 4 4 3 2 1
// 3 4 2 1
// 3 3 1 5
}
if(v.size() == 6) {
add3(v[0], v[1], v[2]);
add3(v[0], v[1], v[2]);
add3(v[0], v[3], v[4]);
add3(v[0], v[3], v[5]);
add3(v[0], v[4], v[5]);
add3(v[1], v[3], v[4]);
add4(v[1], v[3], v[2], v[5]);
add4(v[1], v[4], v[2], v[5]);
add4(v[2], v[3], v[5], v[4]);
return;
}
if(n % 2 == 0) {
int a = v.back(); v.pop_back();
int b = v.back(); v.pop_back();
int c = v.back(); v.pop_back();
int d = v.back(); v.pop_back();
solve(v);
for(int i = 0; i + 1 < v.size(); i += 2) {
int x = v[i], y = v[i + 1];
add4(a, x, b, y);
add4(a, x, b, y);
add4(c, x, d, y);
add4(c, x, d, y);
}
vector < int > v2 = {a, b, c, d};
solve(v2);
return;
}
int a = v.back(); v.pop_back();
int b = v.back(); v.pop_back();
solve(v);
for(int i = 0; i + 1 < v.size(); i += 2) {
int x = v[i], y = v[i + 1];
add4(a, x, b, y);
add4(a, x, b, y);
}
vector < int > v2 = {a, b, v.back()};
solve(v2);
}
int main() {
scanf("%d", &n);
vector < int > v;
for(int i = 1; i <= n; i++)
v.push_back(i);
solve(v);
check();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgcGFpciA8IGludCwgaW50ID4gaWk7Cgpjb25zdCBpbnQgTiA9IDMwMCArIDU7CgppbnQgbjsKaW50IGRzW05dW05dOwp2ZWN0b3IgPCBwYWlyIDwgaWksIGlpID4gPiBhbnM7Cgp2b2lkIGFkZDMoaW50IGEsIGludCBiLCBpbnQgYykgewoJYW5zLnB1c2hfYmFjayh7e2EsIGJ9LCB7YywgMH19KTsKCS8vIHByaW50ZigiMyAlZCAlZCAlZFxuIiwgYSwgYiwgYyk7Cglkc1thXVtiXSsrOwoJZHNbYl1bY10rKzsKCWRzW2NdW2FdKys7Cn0KCnZvaWQgYWRkNChpbnQgYSwgaW50IGIsIGludCBjLCBpbnQgZCkgewoJYW5zLnB1c2hfYmFjayh7e2EsIGJ9LCB7YywgZH19KTsKCS8vIHByaW50ZigiNCAlZCAlZCAlZCAlZFxuIiwgYSwgYiwgYywgZCk7Cglkc1thXVt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