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