#include <bits/stdc++.h>
using namespace std;
int rd() {
  int x;
  scanf("%d", &x);
  return x;
}
const int maxn = 2002;
const int inf = 1012345678;
int n, m;
int a[maxn];
void init() {
  int i, j, k;
  for (i = 1; i <= 1000; i++) a[i] = i * (i - 1) / 2;
}
vector<int> vc[maxn];
int main() {
  int i, j, k;
  init();
  while (scanf("%d", &n) != EOF) {
    for (i = 1; i < 1000; i++)
      if (a[i] <= n && a[i + 1] > n) break;
    int now = i;
    printf("%d\n", now);
    for (i = 0; i <= now; i++) vc[i].clear();
    int cnt = 1;
    for (i = 1; i <= now; i++)
      for (j = i + 1; j <= now; j++)
        vc[i].push_back(cnt), vc[j].push_back(cnt), cnt++;
    for (i = 1; i <= now; i++) {
      for (j = 0; j < (int)vc[i].size(); j++) {
        if (j) printf(" ");
        printf("%d", vc[i][j]);
      }
      puts("");
    }
  }
}
