#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, set<int> > habitants;
  int m = 1;
  int combination = (m * (m - 1)) / 2;
  int sol = 0;
  while (combination <= n) {
    sol = m;
    m++;
    combination = (m * (m - 1)) / 2;
  }
  int nm = 1;
  for (int i = 1; i < sol; i++) {
    for (int q = i + 1; q <= sol; q++) {
      habitants[i].insert(nm);
      habitants[q].insert(nm);
      nm++;
    }
  }
  cout << sol << endl;
  map<int, set<int> >::iterator it = habitants.begin();
  set<int>::iterator setit;
  for (it; it != habitants.end(); it++) {
    setit = it->second.begin();
    for (setit; setit != it->second.end(); setit++) {
      cout << *setit << " ";
    }
    cout << endl;
  }
  return 0;
}
