#include <bits/stdc++.h>
using namespace std;
const int maxn = 10000;
int n, ans[11000];
int f[1100][1100], top;
void build() {
  memset(ans, 0, sizeof(ans));
  int k = 2;
  ans[1] = 2;
  top = 1;
  f[1][1] = f[2][1] = 1;
  while (top <= maxn) {
    int j = ans[top];
    for (int i = 1; i <= j; i++) f[j + 1][i] = f[i][j] = ++top;
    for (; k < top; k++) ans[k] = j;
    ans[k++] = j + 1;
  }
}
void work() {
  printf("%d\n", ans[n]);
  for (int i = 1; i <= ans[n]; i++) {
    printf("%d", f[i][1]);
    for (int j = 2; j < ans[n]; j++) printf(" %d", f[i][j]);
    printf("\n");
  }
}
int main() {
  build();
  while (scanf("%d", &n) != EOF) work();
  return 0;
}
