#include <bits/stdc++.h>
using namespace std;
int i, j, n, x, edge, w;
int head[1000], nxt[100000], ew[100000];
void addedge(int u, int v) {
  ew[++edge] = ++w;
  nxt[edge] = head[u];
  head[u] = edge;
  ew[++edge] = w;
  nxt[edge] = head[v];
  head[v] = edge;
}
int main() {
  memset(head, -1, sizeof(head));
  scanf("%d", &n);
  for (i = 1;; i++) {
    if (n < (i * (i - 1) / 2)) break;
  }
  x = --i;
  edge = 0;
  w = 0;
  for (i = 1; i <= x; i++) {
    for (j = i + 1; j <= x; j++) {
      addedge(i, j);
    }
  }
  printf("%d\n", x);
  for (i = 1; i <= x; i++) {
    for (j = head[i]; j != -1; j = nxt[j]) {
      printf("%d ", ew[j]);
    }
    printf("\n");
  }
  return 0;
}
