#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
const int MAXN = (int)1e6 + 10;
int n;
int days;
int sz;
vector<int> g[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 2; i; i++) {
    if (sz + i - 1 <= n) {
      for (int j = 1; j < i; j++) {
        g[j].push_back(++sz);
        g[i].push_back(sz);
      }
      continue;
    } else {
      days = i - 1;
      break;
    }
  }
  printf("%d\n", days);
  for (int i = 1; i <= days; i++) {
    for (auto it : g[i]) {
      printf("%d ", it);
    }
    puts("");
  }
  return 0;
}
