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