#include <bits/stdc++.h>
using namespace std;
int gun[3600][5002], durum[4000];
int N, sol, kac, son;
int sonuc[20000];
void sonuchesapla() {
  int i;
  for (i = 3; i <= 20000; i++) sonuc[i] = i * (i - 1) / 2;
}
int main() {
  int i, say, j;
  sonuchesapla();
  scanf(" %d", &N);
  for (i = 3; i <= 20000; i++)
    if (sonuc[i] > N) break;
  sol = i - 1;
  kac = sol - 1;
  son = 0;
  printf("%d\n", sol);
  for (i = 1; i <= sol; i++) {
    say = 0;
    for (j = 1; j < i; j++) {
      gun[i][++say] = gun[j][i - 1];
    }
    while (say < kac) gun[i][++say] = ++son;
    for (j = 1; j <= kac; j++) printf("%d ", gun[i][j]);
    printf("\n");
  }
  return 0;
}
