#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, mn = 1e16, mx = 0, ans = 0, t;
int main() {
  cin >> n;
  long long lo = 1, hi = 1000;
  while (lo <= hi) {
    long long md = (lo + hi) >> 1;
    if (md * (md + 1) / 2. <= n) {
      ans = max(ans, md);
      lo = md + 1;
    } else
      hi = md - 1;
  }
  ans++;
  cout << ans << endl;
  vector<vector<long long> > v(ans + 100);
  x = 1;
  for (int i = 0; i < ans; i++) {
    for (int j = i + 1; j < ans; j++) {
      v[j].push_back(x);
      v[i].push_back(x++);
    }
  }
  for (int i = 0; i < ans; i++) {
    for (int j = 0; j < v[i].size(); j++) cout << v[i][j] << " ";
    cout << endl;
  }
  return 0;
}
