#include <bits/stdc++.h>
using namespace std;
vector<int> a[10005];
int main() {
  int n, x, k = 0;
  cin >> n;
  x = (sqrt(1.0 + 8 * n) + 1) / 2;
  cout << x << endl;
  for (int i = 1; i <= x; i++)
    for (int j = i + 1; j <= x; j++) a[i].push_back(++k), a[j].push_back(k);
  for (int i = 1; i <= x; i++, cout << endl)
    for (int j = 0; j < a[i].size(); j++) cout << a[i][j] << " ";
  return 0;
}
