#include <bits/stdc++.h>
const int N = 150;
int a[N + 1][N];
int main() {
  int n, i, j, k;
  while (~scanf("%d", &n)) {
    int x = 1;
    while (x * (x + 1) <= n << 1) x++;
    printf("%d\n", x);
    x--;
    for (i = 1; i < x; i++) printf("%d ", i);
    printf("%d\n", k = x);
    for (i = 1; i <= x; i++) {
      printf("%d", i);
      for (j = 1; j < i; j++) printf(" %d", a[i][j + 1] = a[j][i]);
      for (j = i + 1; j <= x; j++) printf(" %d", a[i][j] = ++k);
      puts("");
    }
  }
  return 0;
}
