#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > ans;
int main() {
  int n;
  cin >> n;
  int k = int(floor((1 + sqrt(1 + 8 * n)) / 2.));
  ans.resize(k);
  cout << k << endl;
  int cnt = 1;
  for (int i = 2; i <= k; ++i)
    for (int j = 0; j + i - 1 < k; ++j)
      ans[j].push_back(cnt), ans[j + i - 1].push_back(cnt++);
  for (int i = 0; i < ans.size(); ++i) {
    for (int j = 0; j < ans[i].size(); ++j) cout << ans[i][j] << ' ';
    cout << endl;
  }
  return 0;
}
