#include <bits/stdc++.h>
using namespace std;
vector<int> ar[10000];
int main() {
  int n, i, j, p;
  cin >> n;
  for (p = 1; p * (p - 1) / 2 <= n; p++)
    ;
  p--;
  cout << p << endl;
  n = 1;
  for (i = 1; i <= p; i++) {
    for (j = i + 1; j <= p; j++) {
      ar[i].push_back(n);
      ar[j].push_back(n);
      n++;
    }
  }
  for (i = 1; i <= p; i++) {
    for ((j) = 0; (j) < (ar[i].size()); (j)++) {
      cout << ar[i][j] << " ";
    }
    cout << "\n";
  }
  return 0;
}
