#include <bits/stdc++.h>
using namespace std;
int f[10005][205];
int main() {
  int n, k, i, s, j, res;
  scanf("%d", &n);
  res = 2;
  s = 1;
  while (s + res <= n) {
    s += res;
    res++;
  }
  printf("%d\n", res);
  k = 0;
  for (i = 2; i <= res; i++) {
    for (j = 1; j < i; j++) f[i][j] = k + j;
    for (j = 1; j < i; j++) f[j][i - 1] = ++k;
  }
  for (i = 1; i <= res; i++) {
    for (j = 1; j <= res - 2; j++) printf("%d ", f[i][j]);
    printf("%d\n", f[i][res - 1]);
  }
}
