#include <bits/stdc++.h>
int tu[1000][1000];
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1 || n == 2) {
    puts("1\n1");
    return 0;
  }
  memset(tu, 0, sizeof(tu));
  int k;
  for (k = 1;; k++) {
    if ((k + 2) * (k + 1) / 2 > n) break;
  }
  printf("%d\n", k + 1);
  int a = 1;
  for (int i = 1; i <= k + 1; i++) {
    for (int j = 1; j < i; j++) tu[i][j] = tu[j][i - 1];
    for (int j = i; j <= k; j++) tu[i][j] = a++;
  }
  for (int i = 1; i <= k + 1; i++) {
    for (int j = 1; j <= k; j++) {
      if (j != 1) printf(" ");
      printf("%d", tu[i][j]);
    }
    puts("");
  }
}
