#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    vector<vector<int> > v(2, vector<int>(1, 1));
    n--;
    int w = 2, k = 2;
    while (n >= k) {
      vector<int> tmp;
      for (int i = 0; i < k; i++) {
        v[i].push_back(w + i);
        tmp.push_back(w + i);
      }
      v.push_back(tmp);
      n -= k;
      w += k;
      k++;
    }
    cout << v.size() << endl;
    for (int i = 0; i < v.size(); i++) {
      cout << v[i][0];
      for (int j = 1; j < v[i].size(); j++) cout << " " << v[i][j];
      cout << endl;
    }
  }
  return 0;
}
