#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double PI = 2 * acos(0.0);
const double EPS = 1e-9;
int dcmp(double a, double b) { return fabs(a - b) <= EPS ? 0 : a > b ? 1 : 2; }
int DI[] = {-1, 0, 1, 0, 1, -1, -1, 1};
int DJ[] = {0, 1, 0, -1, 1, -1, 1, -1};
int main() {
  int n;
  cin >> n;
  int cur = 3, sz = 3;
  while (n >= cur + sz) cur += sz, ++sz;
  vector<vector<int> > ans(sz);
  cur = 1;
  for (int i = 0; i < (int)ans.size(); ++i)
    for (int j = i + 1; j < (int)ans.size(); ++j)
      ans[i].push_back(cur), ans[j].push_back(cur), cur++;
  cout << (int)ans.size() << endl;
  for (int i = 0; i < (int)ans.size(); i++) {
    for (int j = 0; j < (int)ans[i].size(); j++) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}
