#include <bits/stdc++.h>
int maze[1000][1000];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    maze[0][0] = 1;
    maze[0][1] = 2;
    maze[1][0] = 2;
    maze[1][1] = 3;
    maze[2][0] = 3;
    maze[2][1] = 1;
    int k = 3;
    int last = 4;
    n -= 3;
    while (n >= k) {
      for (int i = 0; i < k; i++) {
        maze[k][i] = maze[i][k - 1] = last++;
      }
      n -= k;
      k++;
    }
    printf("%d\n", k);
    for (int i = 0; i < k; i++) {
      for (int j = 0; j < k - 1; j++) {
        if (j) printf(" ");
        printf("%d", maze[i][j]);
      }
      puts("");
    }
  }
  return 0;
}
