#include <bits/stdc++.h>
using namespace std;
vector<int> ans[1200];
void make(int num) {
  if (num <= 0) return;
  for (int i = 0, j = num * (num - 1) / 2; j > (num - 2) * (num - 1) / 2; j--) {
    ans[num - 1].push_back(j);
    ans[i].push_back(j);
    i++;
  }
  make(num - 1);
}
int main() {
  int n;
  while (cin >> n) {
    for (int i = 0; i < 1200; i++) ans[i].clear();
    int num = (int)((sqrt(8 * n + 1) + 1) / 2);
    cout << num << endl;
    make(num);
    for (int i = 0; i < num; i++) {
      for (int j = num - 2; j >= 0; j--) cout << ans[i][j] << " ";
      cout << endl;
    }
  }
  return 0;
}
