#include <bits/stdc++.h>
using namespace std;
const int Maxn = 10005;
int n;
vector<int> val[Maxn];
int main() {
  cin >> n;
  int k = 0;
  while (k * (k + 1) / 2 <= n) k++;
  cout << k << endl;
  int need = 1;
  for (int i = 0; i < k; i++)
    for (int j = i + 1; j < k; j++) {
      val[i].push_back(need);
      val[j].push_back(need);
      need++;
    }
  for (int i = 0; i < k; i++)
    for (int j = 0; j < val[i].size(); j++) {
      cout << val[i][j];
      if (j + 1 < val[i].size())
        cout << " ";
      else
        cout << endl;
    }
  return 0;
}
