#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int k = (1.0 + sqrt(1.0 + 8.0 * n)) / 2.0;
  int d = 1;
  vector<vector<int> > res(k);
  for (int i = 0; i < k; i++)
    for (int j = i + 1; j < k; j++) {
      res[i].push_back(d);
      res[j].push_back(d);
      d++;
    }
  cout << k << endl;
  for (int i = 0; i < res.size(); i++) {
    for (int j = 0; j < res[i].size(); j++) cout << res[i][j] << " ";
    cout << endl;
  }
exit:
  return (0);
}
