#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, n, p[150][150];
  p[0][0] = p[1][0] = 1;
  while (scanf("%d", &n) != EOF) {
    l = 3;
    while (1) {
      if (l * l - l > 2 * n) break;
      l++;
    }
    l--;
    printf("%d\n", l);
    k = 2;
    for (i = 2; i <= l; i++)
      for (j = 0; j < i; j++) p[i][j] = p[j][i - 1] = k++;
    for (i = 0; i < l; i++) {
      printf("%d", p[i][0]);
      for (j = 1; j < l - 1; j++) printf(" %d", p[i][j]);
      printf("\n");
    }
  }
  return 0;
}
