#include <bits/stdc++.h>
using namespace std;
vector<int> v[100010];
int main() {
  int n;
  cin >> n;
  int x = 3;
  while (x * (x - 1) / 2 <= n) x++;
  x--;
  int ind = 1;
  for (int i = 1; i < x; i++) {
    for (int j = i + 1; j <= x; j++) {
      v[i].push_back(ind);
      v[j].push_back(ind++);
    }
  }
  cout << x << endl;
  for (int i = 1; i <= x; i++) {
    for (int x : v[i]) cout << x << " ";
    cout << endl;
  }
  return 0;
}
