#include <bits/stdc++.h>
const int MAX_N = (int)1e5 + 123;
const double eps = 1e-6;
const int inf = (int)1e9 + 123;
using namespace std;
int n;
vector<int> ans[MAX_N];
int k;
int main() {
  cin >> n;
  ans[1].push_back(1), ans[2].push_back(1);
  for (int i = 3, now = 2;; i++) {
    if (n - now + 1 >= i - 1) {
      k = i;
      for (int j = 1; j < i; j++) {
        ans[j].push_back(now);
        ans[i].push_back(now);
        now++;
      }
    } else
      break;
  }
  cout << k << endl;
  for (int i = 1; i <= k; i++) {
    for (auto j : ans[i]) cout << j << ' ';
    cout << endl;
  }
  return 0;
}
