#include <bits/stdc++.h>
using namespace std;
struct Node {
  int i, c;
  Node(int i = 0, int c = 0) : i(i), c(c) {}
  bool operator<(const Node& b) const { return c > b.c; }
};
int c[10005];
int a[1000][1000];
int f[10005];
int main() {
  int n, k;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    if (i * (i - 1) > n * 2) break;
    k = i;
  }
  printf("%d\n", k);
  int cc = 1;
  for (int i = 0; i < k - 1; ++i)
    for (int j = 0; j < k - 1 - i; ++j) a[i][j] = cc++;
  for (int i = 1; i < k; ++i) {
    for (int j = k - 1 - i, p = 0; j < k - 1; ++j, ++p) a[i][j] = a[p][f[p]++];
  }
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < k - 2; ++j) printf("%d ", a[i][j]);
    printf("%d\n", a[i][k - 2]);
  }
  return 0;
}
